Hi Philip,

I don't have an answer to your problem, but I'm curious as to what do you store 
in "local.rkt" and "production.rkt" to justify such a complicated solution.

In the projects that I worked on (Racket or otherwise), local vs production 
differ in the values for different parameters, which are just key => value 
mappings.  In Racket, I would just store these as association lists in 
"local.rktd" and "production.rktd" than in the code just to a:

    (define config-file (if (prodution?) "production.rktd" "local.rktd"))
    (define config (call-with-input-file config-file read))

Than just use `assoc` to find the values for the parameters.

Best Regards,

On Monday, May 1, 2017 at 9:03:45 AM UTC+8, Philip McGrath wrote:
> I'm working on a #lang for configuration files for a larger project I'm 
> working on, and I'm trying to find a setup that meets my (largely cosmetic) 
> goals without producing a "standard-module-name-resolver: cycle in loading" 
> error.
> Given the following directory structure:
> my-project/config.rktconfig/local.rktproduction.rkt
> I would like both to write "local.rkt" and "production.rkt" in "#lang 
> my-project/config" and to have "(require my-project/config)" provide bindings 
> re-exported from "local.rkt" and "production.rkt" and some extra bindings for 
> working with those values.
> This seems like it should be doable, because there aren't any logical cyclic 
> dependencies, but I haven't found a way to convince Racket of that. 
> I initially tried making a "my-project/config/lang/" directory with a 
> "module-lang.rkt" and a "reader.rkt" consisting of "(module reader 
> syntax/module-reader my-project/config/lang/module-language)", then having 
> "config.rkt" require and re-export "local.rkt", "production.rkt", and the 
> appropriate exports of "module-lang.rkt", but this gave me a "cycle in 
> loading" error.
> My first guess was that the problem might be that Racket was looking for a 
> reader submodule of "config.rkt", so I re-wrote "module-lang.rkt" and 
> "reader.rkt" as submodules of "config.rkt" (with "module", not "module*" or 
> "module+"), but this didn't solve the problem.
> Is there a way to do what I want? 
> -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 racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to