ben.knoble
2021-3-15 13:34:18

@samth I meant to ask a similar question, perhaps units are the answer? SML has a module system, and it has parameterized modules (called “functors” in the language)—they receive a module or modules and produce a new module. Does racket have something similar?


samth
2021-3-15 13:34:41

Units are that thing


raoul.schorer
2021-3-15 15:26:25

@samth After reading the doc, it seems that units are parametrized at runtime, right? So I guess that comes with a runtime penalty since the compiler can’t know what the parameter values will be?


samth
2021-3-15 16:00:18

units can be parameterized at runtime, so an inner loop indirected through units will have some runtime cost. I don’t think it’s that much in any case I’ve encountered, though.