On Apr 4, 2015, at 5:26 PM, Erik Silkensen <eriksilken...@gmail.com> wrote:
> Could someone explain how this example works? > > $ racket > Welcome to Racket v6.1.1. > -> (require racket/sandbox) > -> (define racket-eval (make-evaluator 'racket)) > -> (define a (racket-eval '(set 1 2 3))) > -> a > (set 1 2 3) > -> (set? a) > #f > -> (define racket-eval-again (make-evaluator 'racket)) > -> (equal? a (racket-eval-again '(set 1 2 3))) > #f > > Is it something particular to set? (Or objects like that?) I don’t really know how this works, but if you do this: > (define racket-eval2 (parameterize ([sandbox-namespace-specs (append (sandbox-namespace-specs) `(racket/set))]) (make-evaluator 'racket))) > (define b (racket-eval2 '(set 1 2 3))) > (set? b) #t Then it works more like you would expect. The documentation for sandbox-namespace-specs says this: The module paths are needed for sharing module instantiations between the sandbox and the caller. For example, sandbox code that returns posn values (from the lang/posn module) will not be recognized as such by your own code by default, since the sandbox will have its own instance of lang/posn and thus its own struct type for posns. To be able to use such values, include 'lang/posn in the list of module paths. -- 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.