On Thursday, August 1, 2013 10:19:39 PM UTC-4, Jesse McNelis wrote:
Go doesn't really support plugins and it's a bit too strict for terrible programmers.
I've been thinking a lot about plugins and Go. There are a couple of ways to achieve this that might be made easier with a library to help with the gluing.
I think the most interesting one is the most obvious: plug-ins run as their own processes. In every plugin system, there's a registration mechanism; in this case, the registration would be over a socket. Something like
Skynet could help, but a more focused implementation that is less flexible than Skynet could reduce the function call overhead. It'll be interesting to see how this performs. A little glue could make using a plug-in framework easier: a service daemon to re/start plugins, a standard capability registration utility library, something like netchan to handle the function calls, etc.
The other common approach, where plugins are part of the application -- they register through some internal API, and you put your plugin in a directory and recompile the whole thing -- works pretty well. There are cases where it is harder to make work properly (e.g., an IRC bot, where you would like to reload plugins without having to have the bot reconnect after being restarted, or an IDE where it is undesireable to have to restart the entire IDE after installing a new plugin), but it's fine for request servers when you use something like
goagain.
You're right in your statement that Go doesn't
support plugins; most people think a core aspect of plugins is hot code loading at run time. The main thing that's stopped me from writing a library is that I believe making a good plugin system is not as trivial as it sounds, and I'd rather collaborate with somebody who's been waist-deep supporting the application-side of a plugin system to know what it needs to support. Somebody from the Eclipse (or other IDE system), for example; I think those are the most demanding plugin systems.
Sorry for veering off-topic a bit. To circle back around, Wordpress would do fine with a "recompile entire application to get new plugins" model, using goagain to keep the service up. No magic necessary; just some deep thinking about the plugin API.
--- SER