[racket-dev] printing images in REPL
I guess you don't have the print handler set up right.
On Sat, Aug 28, 2010 at 8:23 PM, Shriram Krishnamurthi <sk at cs.brown.edu> wrote:
> The value I was returning is whatever kind of object is returned when
> you embed an image in the Definitions window. That is, this was a
> pasted, atomic image, not one created by a computation. I guess
> they're not treated the same, but I'm surprised that ASL processing
> the Definitions window didn't do the right conversion...
>
> On Thu, Aug 26, 2010 at 8:25 PM, Robby Findler
> <robby at eecs.northwestern.edu> wrote:
>> At the moment there is a barn-door sized security hole in DrRacket,
>> whereby it will take any snip% instance from the user's program and
>> just display it in the repl. You can exploit this for Good by making
>> the current-print of your language turn some values into snips (like
>> images and things). 2htdp/image already does this, so that should just
>> work if you return those. Its hard to tell what value Shriram's
>> program was returning tho. But if it is a bitmap% object, he just has
>> to do
>>
>> (make-object image-snip% ...the-bitmap-goes-here...)
>>
>> We will close this hole at some point, when we have a reasonable way
>> to allow people to add new kinds of values without the security
>> breach.
>>
>> Robby
>>
>> On Thu, Aug 26, 2010 at 6:17 PM, Jay McCarthy <jay.mccarthy at gmail.com> wrote:
>>> From what I can tell, it comes from ensuring that DrRacket shares the
>>> htdp/image (or whatever) namespace with the running program so the
>>> structs are the same and DrRacket's default renderer is detecting it.
>>> I'm not sure how to replicate it though. (I tried for a bit so I could
>>> make #lang frtime work.)
>>>
>>> Jay
>>>
>>> On Thu, Aug 26, 2010 at 11:55 AM, Shriram Krishnamurthi <sk at cs.brown.edu> wrote:
>>>> What is the #lang magic that makes
>>>>
>>>>> (get-image-from-web "http://racket-lang.org/logo.png")
>>>> (instantiate (class ...) ...)
>>>>
>>>> show the image rather than just its constructor?
>>>>
>>>> Shriram
>>>> _________________________________________________
>>>> For list-related administrative tasks:
>>>> http://lists.racket-lang.org/listinfo/dev
>>>>
>>>
>>>
>>>
>>> --
>>> Jay McCarthy <jay at cs.byu.edu>
>>> Assistant Professor / Brigham Young University
>>> http://teammccarthy.org/jay
>>>
>>> "The glory of God is Intelligence" - D&C 93
>>> _________________________________________________
>>> For list-related administrative tasks:
>>> http://lists.racket-lang.org/listinfo/dev
>>
>