jbclements
2018-1-10 15:40:58

@blerner thanks!


shu--hung
2018-1-10 19:25:30

In dynamic-require, how can a module be instantiated but not visited? Is this possible only when the module is already available?


mflatt
2018-1-10 19:33:27

@shu—hung I’m not sure I understand the question. The dynamic-require function can instantiate a module without visiting it or making it available (where “available” is a lazy “visit”). So, dynamic-require is a core operation, and it’s the way that a module instance gets into that state.


shu--hung
2018-1-10 19:39:43

Here is what I have in mind: - visit: triggered mostly by require when expanding (and compiling) a module; will execute programs in begin-for-syntax or higher - instantiation: evaluates the code in a module outside begin-for-syntax


shu--hung
2018-1-10 19:42:14

Then it seems like even if we use dynamic-require to instantiate a module (either with #f or 0), the module could be visited if it is not already compiled / registered in the namespace. Is this correct?


mflatt
2018-1-10 19:54:54

An operation like require of dynamic-require works in two steps: resolve a module path, and then do something involving instantiation and visits. Resolution of a module path may have the side effect of causing a module to be declared, perhaps even by loading it from source — in which case, yes, an instance will be visited as part of expanding it to arrive at a module’s own declaration. That’s an instance of an instance of an ephemeral “module being expanded” module, though. After expansion and evaluation, the newly declared module starts out in a state with no instances and visits.


shu--hung
2018-1-10 19:55:37

That clears up things! Thanks a lot


shu--hung
2018-1-10 19:56:15

Right, I almost forgot about module loading from source triggered by module name resolving


greg
2018-1-10 21:05:19

@sanchom The source appears to be here https://github.com/mbutterick/pollen/blob/master/pollen/decode.rkt#L51-L70 At a quick glance the order they’re applied is a result of recursively walking the x-expr, and some procs obviously only apply to certain kinds of elements.