[racket] image equality and evaluators
Sweet. I'll try that out when I get back to the machine tomorrow. Thanks for the speedy help!
Best,
jmj
--
Sent from my Android phone with K-9 Mail.
Robby Findler <robby at eecs.northwestern.edu> wrote:
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120209/b4df232a/attachment-0001.html>