Maybe Rust should have function references, too

Run each native plugin in a separate process from the main application, communicating via socket pairs and/or shared memory. Then any plugin can be reloaded by restarting that plugin's process.

This architecture has so many other advantages -- plugins cannot crash the main application, you can sandbox them independently from the main application, you're forced to design and commit to a stable plugin API, etc -- that I would recommend any new application use it as its initial design for plug-in modules, and consider moving them into the main process only if the communication overhead of out-of-process plugins proves to be an intractable bottleneck.

8 Likes