[racket] image equality and evaluators

From: Nadeem Abdul Hamid (nadeem at acm.org)
Date: Sat Feb 11 18:46:08 EST 2012

Nice - this is useful to me too, thanks very much. FWIW, instead of
I had to use
to avoid a "cannot instantiate `racket/gui/base' a second time in the
same process" error.

On Thu, Feb 9, 2012 at 10:15 PM, 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

Posted on the users mailing list.