For expression evaluation better to use expr https://github.com/antonmedv/expr
I’ve seen that! Looks great, looking forward to using it in my projects!
Go has -buildmode=plugin https://golang.org/pkg/plugin/. I have been meaning to experiment a bit more with it, but it seems like a better way then on-the-fly compiling the go files?
yaegi doesn’t compile scripts (it’s an interpreter). On my machine, the trivial script in this article takes 4-5ms to execute (3-4ms initialization, 1ms script running, func calling). That’s good enough for me.
At any rate, plugins come with some limitations
It depends on the kind of application you’re building. “Pro” versions are probably better done with build tags. For scripts (think mpv), requiring the Go toolchain to make plugins is a bit much. And if you do, might as well make them recompile the application - Go compiles quickly. I don’t really see a use case where plugins would work best. Even for extending proprietary applications, it would generate a lot of support load (wouldn’t be the best UX either).
See also: https://tpaschalis.github.io/golang-plugins/
Hashicorp’s go-plugin looks interesting.