You can use dynamic-require and grab the identifiers you need one by
one. Fine if there are few.

You can set up a namespace, dynamic-require into it, and then eval the
code you want inside the namespace. Okay for many ids, but code to run
will be a little painful to write, so hopefully small.

You can make a macro expand to the require and look at get-env in the
compile-time, but now you have to compile and run your code rather
than compiling it first. My guess is that this is not a big deal for
your use case. I'd recommend this if you can.

Jay

On Thu, Jun 15, 2017 at 9:49 AM, Kathi Fisler <[email protected]> wrote:
> We need to be able to construct a path to require based on a command-line
> argument.  We currently put the command-line value into an environment
> variable, using get-env to extract the value. In other words, we want to do
> (the equivalent of)
>
>      (require (string-append "courses" (get-env WHICHCLASS) "defs.rkt"))
>
> How can we pull off something with this behavior, since evaluating seems
> incompatible with require syntax.
>
> thanks,
> Kathi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-dev/f66540c6-92db-4c58-8622-b1b765309921%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



-- 
-=[     Jay McCarthy               http://jeapostrophe.github.io    ]=-
-=[ Associate Professor        PLT @ CS @ UMass Lowell     ]=-
-=[ Moses 1:33: And worlds without number have I created; ]=-

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/CAJYbDanoWCajHx52vJqMZ-yp4OSANZ1codsXhG5gyH53wW-pZg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to