[racket] image equality and evaluators

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Thu Feb 9 22:15:27 EST 2012

On Thu, Feb 9, 2012 at 9:12 PM, Eli Barzilay <eli at barzilay.org> wrote:
> The other way is what gets you what you want: you need to use
> `sandbox-namespace-specs' to make the sandbox share an instance of the
> necessary modules between your own code and the sandbox, so that
> structs in the sandbox are the same type as your own.  Here's a quick
> example:
>  #lang racket
>  (require racket/sandbox 2htdp/image)
>  (define ev
>    (parameterize ([sandbox-namespace-specs
>                    (list make-base-namespace '2htdp/image)])
>      (make-evaluator 'racket #:requires '(2htdp/image))))
>  (image? (ev '(rectangle 2 2 'solid 'blue)))

This is what I meant by "complex (fiddling with namespaces)" but I see
that happily it isn't complex and the sandbox happily does the
fiddling for you.


Posted on the users mailing list.