-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
skylark plugins? #46
Comments
Please expand, and how is this a bug? |
I removed the bug label... it was a misclick, but I can't remove the history of what happened (at least, I don't think so). So... skylark is an embedded interpreter for skylark, which is a language that is essentially python-lite. It's exactly python syntax with some restrictions on what is and is not supported. The nice thing is that python syntax is familiar to a lot of people (more so than Lua, the only other language offering an embedded interpreter in go). And it means that you can distribute plaintext files as plugins, with no external dependencies. That's a lot friendlier to end users. |
Ah! Okay, sorry I also missed the removed part, just saw the red flag and stopped there. So you are saying adding native support for this? I thought the plugins as we know now have arisen from thinking in language agnostic way. This can completely be handled by an external plugin that does skylark gymnastics leaving the gnorm binary to do what its best at i.e code generation. Any ideas how you want to integrate this? |
interesting idea to have a plugin that handles skylark plugins. I like that it keeps the main gnorm code simpler.... but at the same time, it means you now have to worry about two executables when running any random gnorm build - gnorm and gnorm-sky (or whatever we'd call it) I see skylark plugins as a really great option for people that want to distribute "themes" with no dependencies outside of the gnorm binary. For internal corporate use, you can just build any old binary plugin and not need to worry about the end user, because you know what your fellow devs will have installed on their workstation. I don't exactly know how to integrate it yet, because I haven't had a chance to dive into skylark. I don't entirely understand how data gets into and out of a skylark plugin, for example (the API talks about setting global variables, but not entirely sure how that works in practice). My idea is that it'll work basically like plugins do now. you say |
A quick glance on skylark godoc shows that the globals doesn't mean global env vars as we know, more like global context on the program/file execution. Still, I believe my idea to outsource skylark support is solid. We introduced plugins to allow extending the functionality without jeopardizing gnorm sanity. So, here is what I am thinking. Say you have a file First, our current plugin is limiting in the number of arguments and contexts to pass. i.e
One easy workaround is to add a helper function for assigning values to maps or slices, which returns new maps or slices with the new values added.
This way the plugin will be extremely configurable. The whole point of custom directories for plugins is for people serious enough with what they run i.e corporate e.t.c . If they were happy enough to have the gnorm binary it won't hurt them to have skylark plugin binary that they can ship with the templates. |
FYI - this is a good example of how to actually use skylark: https://github.com/google/skylark/blob/master/example_test.go#L21 |
Very neat, maybe they were targeting embedding of the interpreter in Go. |
Yeah, that's exactly what I'm talking about - having the interpreter embedded in Go, so that plugin authors just need to write a .sky file and gnorm can run them with a few lines of code that imports the skylark package.... no external binary needed. |
Since the external plugin will still be a go program that embeds the interpreter. Instead of guessing, how about we start with external plugin, and when users like it enough we can add native support for it. I'm skeptic because today is like the first time I heard about skylark, and natively supporting a feature that has no users is an overkill. |
that is a really really good point :) . I agree. :) |
relevant link https://github.com/natefinch/skyhook |
https://github.com/google/skylark
The text was updated successfully, but these errors were encountered: