Thanks, Shu-Hung

With your help, I got it working for the application I was
using this for.

The main thing that made the difference for me was the
(require racket/runtime-path (for-syntax .....) thing
and including *a lot* of libs in the call to `raco exe`

I'm still using `load` because I need to be able to
write arbitrary functions in `include.rkt`

Thank you so much!


On Monday, May 7, 2018 at 12:11:28 PM UTC-4, Shu-Hung You wrote:
>
> #lang racket/load and (load PATH) are less idiomatic and more 
> low-level in Racket. I don't know how did racket/load and load 
> interact with ``raco exe'' but here's another way to make it work. 
> Everything is placed inside modules. 
>
>
> $ racket test.rkt 
> ... ok ... 
>
> $ raco exe ++lib racket/base/lang/reader test.rkt 
> $ ./test 
> ... ok ... 
>
> ;; include.rkt 
> #lang racket/base 
> (provide new-config) 
> (define new-config "new-value") 
>
>
> ;; test.rkt 
> #lang racket/base 
>
> (require racket/runtime-path 
>          ;; (for-syntax racket/base) is for expansion-time 
>          ;; evaluation in define-runtime-path 
>          (for-syntax racket/base)) 
> (define *CHANGED-STRING* "old") 
>
> (define-namespace-anchor a) 
> (define ns (namespace-anchor->namespace a)) 
>
> (define-runtime-path 
>   inc-path (string->path "include.rkt")) 
>
> (define (load-rc) 
>   (parameterize ([current-namespace ns]) 
>     (set! *CHANGED-STRING* (dynamic-require inc-path 'new-config)))) 
>
> (load-rc) 
>
> (printf "~A~%" *CHANGED-STRING*) 
>
>
> On Mon, May 7, 2018 at 10:50 AM, Tony Fischetti 
> <tony.fi...@gmail.com <javascript:>> wrote: 
> > 
> > This is some really great advice! Thanks! 
> > 
> > I'm still confused about why making an executable isn't working. Am I 
> doing 
> > something wrong? 
> > Even if I choose the framework option for *this* project (it seems like 
> a 
> > really helpful thing) 
> > I'd like to be able to distribute, for example, `.app` "executables" to 
> > MacOS users who 
> > just want stock configuration, etc... 
> > The existence of an `.app` executables is helpful in other ways, as 
> well. 
> > For example, 
> > starting an application at startup, icons, etc... 
> > 
> > 
> > 
> > On Monday, May 7, 2018 at 11:16:32 AM UTC-4, Neil Van Dyke wrote: 
> >> 
> >> Regarding overriding globals, a Racket `parameter` is more idiomatic: 
> >> https://docs.racket-lang.org/reference/parameters.html 
> >> 
> >> And/or, you could load your config file as a module, like `info.rkt` 
> is. 
> >> 
> >> You might find `dynamic-require` and friends interesting: 
> >> 
> >> 
> https://docs.racket-lang.org/reference/Module_Names_and_Loading.html?q=dynamic-require#%28def._%28%28quote._~23~25kernel%29._dynamic-require%29%29
>  
> >> 
> >> For one different way to think about config files, especially if your 
> >> users are programmers, perhaps your application program could be a 
> >> framework, and the config file is the program that the user runs, and 
> >> that config file program instantiates the framework: 
> >> https://groups.google.com/forum/#!topic/racket-users/6hn9J-r0Nek 
> >> 
> > -- 
> > 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...@googlegroups.com <javascript:>. 
> > For more options, visit https://groups.google.com/d/optout. 
>

-- 
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