[racket] image equality and evaluators
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.
Robby