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> > . > -- 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/CAL3TdOP%3Diwf5PvNk6myn1i4b0qvgx2mC82m2GLKavPqQTxcVaw%40mail.gmail.com.

