At Thu, 12 Nov 2020 23:35:11 +0100, Dominik Pantůček wrote: > If I however try to achieve the same goal using module form within my > module, it always fails: > > (module sandbox racket/base > (provide #%app #%datum test) > (define (test) (displayln 'test))) > (parameterize ((current-namespace (make-base-empty-namespace))) > (namespace-require ''sandbox) > (eval '(test)))
Using ''sandbox as an argument to `namespace-require` to refer to a local module is something like passing 'x to `eval` to try to refer to a local variable `x`. The `namespace-require` procedure doesn't know where it's being called from, so it doesn't work. Try `quote-module-path`, which expands at compile time to effectively embed its context: #lang racket/base (require syntax/location) (module sandbox racket/base (provide #%app #%datum test) (define (test) (displayln 'test))) (parameterize ((current-namespace (make-base-empty-namespace))) (namespace-require (quote-module-path sandbox)) (eval '(test))) -- 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/20201112154536.1b9%40sirmail.smtps.cs.utah.edu.