Thanks Jay for the helpful response as usual Jay; I really do appreciate
it.

It sounds like what I want is the case of the export.  I think I can
figure out how to modify the #%module-begin to do that.

I guess a question remaining then is: if I'm doing this kind of dynamic
import of the module, is there a way to require from it (especially if
it isn't assigned to a "filename" on disk?).  It appears there must be;
when I look at `build-program` in sandbox.rkt it also looks like it's
wrapping things in a module structure... but I don't see how it then
exports from that module or how the code evaluating it imports its
export.  Or does it actually do so via an effect?  I see there are some
channels involved (input-ch / result-ch) so maybe it's passing back the
result through there, but I am having trouble figuring out how.

Having said all that, maybe I can envision a way to make it work:

 - Have a parameter that, when parameterized, sets up the expected
   channel that a module, upon being loaded, is expected to return its
   "result" from.
 - When evaluating the module, parameterize that channel; read from
   it after evaluating and extract the value.

Does that seem like the right approach?  I guess I will give it a try,
anyway.

 - Chris

Jay McCarthy writes:

> Modules don't evaluate to values. They have effects and they have
> exported symbols. If you want to observe the evaluation of your
> language's module, you'll have to look at one of those two things.
> Both are used by existing Racket languages and infrastructure: `raco
> test` relies on test modules making effects on a global box that
> counts how many tests ran and failed. `scribble` relies on inspecting
> an export named `doc`. In either case, I think you want to make
> `#%module-begin` capture the last expression and expose its value via
> an effect or an export.
>
> Jay

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/87y2wnhjsm.fsf%40dustycloud.org.

Reply via email to