When I run

```
#lang racket/load

(module p racket/base
  (define out (make-parameter 'original-value))
  (provide out))
(module a racket/base
  (require 'p)
  (displayln (list 'a (out)))
  (define a 43)
  (provide a))
(require 'p)
(displayln (list 'outer (out)))
(out "foo")
(displayln (dynamic-require ''a 'a))
```

I get

```
(outer original-value)
(a foo)
43
```

as expected

--
Jay McCarthy
Associate Professor @ CS @ UMass Lowell
http://jeapostrophe.github.io
Vincit qui se vincit.

On Sun, Nov 10, 2019 at 10:37 AM Jens Axel Søgaard
<jensa...@soegaard.net> wrote:
>
> Hi All,
>
> How can I set a parameter used in a dynamically required module?
>
> Example:
> A parameter `out` is defined in a module p.
> Before requiring (dynamically) module a, we want to set the parameter.
>
> The attempt below fails.
>
>     (module p racket/base (define out (make-parameter 'original-value)) 
> (provide out))
>     (module a racket/base (require 'p) (displayln (list 'a (out))) (define a 
> 43) (provide a))
>     (require 'p)
>     (displayln (out))
>     (out "foo")
>     (dynamic-require ''a 'a)
>
> The output is:
>     (a original-value)
>     original-value
>     43
>
> I am hoping to see (a "foo").
>
> /Jens Axel
>
> --
> 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/CABefVgxbZ5Jo1Gee8PCEArHSTrT9TBqcvUCZJoKB0QV3duHEgw%40mail.gmail.com.

-- 
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/CAJYbDamY0okPu%2B-SCZAkffn2Xy-2B-hb8nsDU9mwAvL87zr%3DHQ%40mail.gmail.com.

Reply via email to