I was using the image? predicate as an arbitrary example of something you
might want to do with an image after extracting it from the sandbox.  What
if I wanted to pass the result along to beside or overlay?

In all cases, these functions don't recognize the result as an image:

beside: expects an image as first argument, given (object:image% #f #f #f
#f 1 0 (object:image-snipclass% #f "((lib \"image-core.ss\" \"mrlib\") (lib
\"image-core-wxme.rkt\" \"mrlib\"))" 1) #0=(object:style% (object:color% 0
0 0 1.0 #f) (object:color% 255 255 255 1.0 #f) (object:font% #f 'aligned
'#(12...

On Tue, May 26, 2020 at 4:58 PM Robby Findler <[email protected]>
wrote:

> It might be easiest to just use the `image?` predicate from inside the
> sandbox. Get it out the same way you got the image itself out.
>
> Robby
>
>
> On Tue, May 26, 2020 at 6:22 PM Stephen Foster <[email protected]>
> wrote:
>
>> The following returns #f and #t.  How can I get it to return #t and #t?
>>
>> Context: I want to allow students to run Racket code on my server. But
>> when I sandbox their code, I am getting back something that doesn't behave
>> like a 2htdp/image object.  I'm not exactly sure what it is.
>>
>> #lang racket
>>
>> (require racket/sandbox 2htdp/image)
>>
>> (sandbox-path-permissions
>>   (list
>>     '(exists
>>        "/usr/lib/ssl/cert.pem")
>>     '(exists
>>        "/usr/lib/ssl/certs")))
>>
>> (define user-code '(circle 40 'solid 'red))
>>
>> (define circle1
>>   ((make-evaluator 'racket
>>                    `(define f
>>                       (let ()
>>                         ,user-code))
>>                    #:requires
>>                    '(2htdp/image))
>>    'f))
>>
>> (define circle2
>>   (circle 40 'solid 'red))
>>
>> (image? circle1) ;#f but I want it to be #t
>> (image? circle2) ;#t
>>
>>
>> If it helps, when I print out the above values with ~a, I get:
>>
>> "#(struct:object:image% ... #(struct:translate 40 40 #(struct:ellipse 80
>> 80 0 255 red)) #(struct:bb 80 80 80) #f #f #f #f #t)"
>>
>> "#(struct:object:image% ...)"
>>
>> --
>> 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 [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/ebf8bf84-23d6-45f3-9b1d-6bb6bf592b8e%40googlegroups.com
>> <https://groups.google.com/d/msgid/racket-users/ebf8bf84-23d6-45f3-9b1d-6bb6bf592b8e%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>

-- 


Stephen Foster
ThoughtSTEM Co-Founder
318-792-2035

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CA%2BzSu29untSJzX0yuyzbOuCiz_xewsgkXBkYHZVnLeHBkwT1mg%40mail.gmail.com.

Reply via email to