I think you can check the source of `raco` which uses the `info.rkt` to
search all subcommands(see `racket/getinfo`). In this way, all plugins are
just normal packages, you do not have to reside them is a specific
directory. Certainly, the plugin is loaded via `dynamic-require`, if the
plugin needs the imports of main application, I think sandbox is not
necessary.

More precision, a plugin is just a normal module, if it requires the
modules that your main application uses, they will share the same status,
say you can use `(parameterize
([common-or-specific-parameters-for-the-plugin val]) (dynamic-require "..."
'greetings))` to let the plugin know its working environment; Inside the
plugin, it provides a name `greetings` with a structured value that
contains the proper icons, panel instances and so on, then the main
application will know how to deal with the plugin.

In my application, I prefer the logging facility, unlike logging facilities
in other languages, the racket one is also a multi dispatching asynchronous
mechanism which is more efficient than pipes and channels (if you do not
use place). The typical use case is, the splash screen and the main
application are both listening on the `current-logger`, and the plugin logs
itself with the proper info to `current-logger`, then the splash screen
will know a new icon should be drawn, while the main application will know
a new panel should be added to the workspace (both of them will receive all
the info but only pick up the interesting parts).

On Tue, Feb 7, 2017 at 7:21 PM, Erich Rast <er...@snafu.de> wrote:

> Hi all!
>
> I'm thinking about implementing a dynamic plugin system for a large
> application. Each plugin should have the full racket/gui language and a
> number of pre-defined imports from modules of the main application
> available. Plugins should reside in a relative directory and loadable
> on demand at runtime, and I also need a way to check in the main
> application that they export certain plugin data like a name, an icon
> and a panel% class. Plugins do not need to export any macros. Security
> is not a concern and all plugins are local.
>
> My questions: Is that possible? What's the right way of doing it, should
> I use dynamic-require or racket/sandbox? How would you convert an
> ordinary module with a #lang statement and various requires into such a
> dynamic plugin?
>
> Best,
>
> Erich
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to