Hacker News new | ask | show | jobs
by morelisp 1360 days ago
If I was going to try to make something "similar to Wordpress" with Go I would replace plugins with optional packages triggered by build flags (or possibly a light codegen step), not an actual dynamic plugin system. The Wordpress model is solved with plugins in PHP (for reasons that were to some degree bad even at the time), but it's not actually "I want to inject some external code into this existing process environment", it's "I want a bespoke N of M features because some Ms are mutually exclusive or have overhead I can't afford".

If you have a language that has a module ecosystem, compiles fast, and generates a single binary, take advantage of that; don't try to reimplement fragile dynamic linking.

2 comments

I'd like to point out also that wordpress can install plugin directly from the UI, which is a lot more involved if it requires the whole software to be recompiled (totally different machine too)
There’s no reason that UI can’t kick off a recompile on the backend, nor any reason it has to be a different machine.
Recompiling the whole software is way more expensive than pasting a file on the filesystem, that was my point.
But it’s not so expensive you can’t do it. If you cache it’s probably not even so expensive anyone will notice compared to the equivalent PHP process. And it would be a massive operational, usability, and performance improvement to the actual server.

Otherwise you’re just saying “I can’t write Go like PHP” - no shit, that’s a good thing.

WordPress is an example. For C# videogame bots, the software is delivered as a compiled executable file (no sources) and plugins are sold as DLLs that you can just copy-paste in a directory.

Kerbal Space Program (videogame) is a big compiled executable and plugins are loaded as DLLs from a directory.

I'm not trying to reimpostare anything, I just wish it was available.