skapata has quit [Remote host closed the connection]
ormaaj has quit [Quit: moo :)]
ormaaj has joined #racket
Origin has quit [Ping timeout: 260 seconds]
macabro has quit [Ping timeout: 252 seconds]
ASau has quit [Quit: ERC (IRC client for Emacs 27.2)]
m1dnight has quit [Quit: WeeChat 3.0]
chiselfuse has quit [*.net *.split]
dzoe has joined #racket
m1dnight has joined #racket
<Putonlalla>
I read through the documentation of `dynamic-require` and tried to use it, but could not dynamically load every provided definition of a module into the current namespace, which is what `require` does. How do you actually dynamically `require`?
chiselfuse has joined #racket
skapata has joined #racket
<Putonlalla>
What I'm actually trying to do is create a sequence of dependent submodules from which I can load all the definitions up to a certain point.
Origin has joined #racket
<samth>
Putonlalla: you might want `namespace-require`
<Putonlalla>
It looks promising, but gives me `unbound identifier` errors.
<Putonlalla>
That is, `(require (submod "modules.rkt" m))` works, while `(for-each (lambda (m) (namespace-require `(submod "modules.rkt" ,m))) (list 'm))` does not. Perhaps it needs some kind of anchor outside the `for-each`.
<samth>
which identifier is unbound?
<Putonlalla>
Anything provided by `m`.
skapata has quit [Ping timeout: 265 seconds]
skapata has joined #racket
<samth>
are you eval'ing it in the relevant namespace?
<samth>
can you provide an example that I can try?
<Putonlalla>
I'm not using `eval` at all. That might be the problem.
<samth>
then what did you mean about the current namespace? namespaces are a construct used with eval
<samth>
Racket does not have a way to bind in a program names determined at runtime (except in the top-level, which is fundamentally a wrapper around eval)
<Putonlalla>
Oh.
<Putonlalla>
How do you use `eval` to implement `require` then?
<Putonlalla>
My actual problem is that `module->exports` stops working when I put it in a sandbox, and I have no idea why, so I'm trying to implement these basic things to understand how they work.
<Putonlalla>
The documentation is quite useless for this purpose, because it doesn't contain enough information to infer how things are going to work when you run them. There are no links to source code or formal semantics either.
<Putonlalla>
A sentence like "absolute and relative module paths form a torsor with the following operations" would be immensely more helpful than the prose and incomplete examples we currently have, and would most likely also lead to a more coherent api.
CodeSpelunker has joined #racket
mdhughes_ has joined #racket
mdhughes has quit [Ping timeout: 272 seconds]
Tuplanolla has joined #racket
CodeSpelunker has quit [Quit: CodeSpelunker]
<samth>
Putonlalla: I don't know what it means to implement require in terms of eval
<samth>
if you're using eval, then you can just `(eval '(require foo))`
<samth>
if what you want is to call some API that binds identifiers, then Racket very intentionally does not provide anything that does that
<samth>
in general if you want to use `(module->exports m)` just doing `(dynamic-require m (void))` as the example in the docs suggests, should be enough
<samth>
but if you can give an example then I can help more
CodeSpelunker has joined #racket
cow_2001 has quit [Quit: ✡]
cow_2001 has joined #racket
macabro has joined #racket
CodeSpelunker2 has joined #racket
macabro has quit [Remote host closed the connection]
macabro has joined #racket
CodeSpelunker has quit [Ping timeout: 248 seconds]
macabro has quit [Read error: Connection reset by peer]
macabro has joined #racket
CodeSpelunker2 has quit [Ping timeout: 248 seconds]
CodeSpelunker2 has joined #racket
CodeSpelunker has joined #racket
CodeSpelunker has quit [Client Quit]
CodeSpelunker2 has quit [Ping timeout: 276 seconds]