On Sat, May 23, 2020 at 5:04 PM Simon Schlee <[email protected]> wrote:
> I also would find it interesting to have something functor like, in the > sense of being able to create parameterized module instances. > My guess is that constructs like that are difficult to optimize and the > separation between runtime and compile time can become extremely blurry. > To the point that certain dynamic constructs would cause big chunks of > code to become ready for compiling at run-time only and at that time an > interpreter might be faster. > In fact, Racket has such a construct, units <https://docs.racket-lang.org/guide/units.html>. They are first-class values, with run-time operations to link and invoke them, and they allowing for cyclic dependencies and multiple instantiations of a given unit. One of the major design goals of units was support for separate compilation (units predate `module` in Racket), which may rule them out for Nia's goal of modules with "optional *compile-time* arguments" per se. I guess I'm interested in what sorts of things these optional arguments might be used for: if dealing with the arguments could instead be done at link- or invoke-time, you might be able to use units to implement this module system. Regardless, I recommend anyone thinking about implementing a unit-like system look closely at units first: even when I ultimately ended up implementing my own unit-like system to meet a specific need (this was part of my RacketCon talk), my experience with units was very valuable in doing so. -Philip -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/racket-users/CAH3z3gY4e%2BsvAQhHrtj21%3DJ2-%2B6GvVDhPpMY0PkiqbjzaNjOsQ%40mail.gmail.com.

