[plt-scheme] escape continuations and mred callback

From: pedro pinto (pedro.e.pinto at gmail.com)
Date: Sat Oct 7 12:55:47 EDT 2006

I understand the callback is called from somewhere in the bowels of the MrEd
code, after a GUI event has been extracted from the UI message queue. I also
can imagine that escaping from the callback will prevent some resource
cleanup, but I interpreted your original email as hinting at something
fundamentally wrong with escaping from *any* callback. Maybe I
misunderstood?

-pp


On 10/6/06, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
>
> Every function is called from some place, right? So think of your
> callback function. It must be called from some place. That is also
> the place where it returns to. QUESTION: Where is that?
>
> -- Matthias
>
>
>
> On Oct 6, 2006, at 8:06 PM, pedro pinto wrote:
>
> > I am sorry, this continuation stuff makes my head spin. I
> > understand the barrier idea but I don't understand the motivation.
> > A callback is just another function, why is it barred from escaping?
> > -pp
> >
> >
> > On 10/6/06, Matthias Felleisen <matthias at ccs.neu.edu> wrote: There
> > is a built-in barrier -- a delimiter of control -- around
> > callbacks. If you think about it, it's quite obvious. A callback
> > doesn't return. But at the same time, all functions do return
> > somewhere. Well the place that is invisible and unavailable to you is
> > somewhere in the system. And right around this call site there is a
> > barrier for all escapes. -- Matthias
> >
> >
> >
> > On Oct 6, 2006, at 7:19 PM, pedro pinto wrote:
> >
> > > Hi there,
> > >
> > > Shouldn't this:
> > >
> > >   (require (lib "class.ss")
> > >            (lib "mred.ss" "mred"))
> > >
> > >   (define (go)
> > >     (let/ec return
> > >       (let ((f (new dialog% (label "Hello"))))
> > >         (new button% (parent f)
> > >              (label "Me, Me!")
> > >            (callback (lambda _
> > >                        (send f show #f)
> > >                        (return "Escaping"))))
> > >         (send f show #t)
> > >         "Did not Escape")))
> > >
> > >   (go)
> > >
> > >
> > >
> > > Evaluate to "Escaping" when the user clicks the "Me,Me!" button?
> > >
> > >
> > >
> > >
> > > _________________________________________________
> > >   For list-related administrative tasks:
> > >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> >
> >
> > _________________________________________________
> >   For list-related administrative tasks:
> >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20061007/13e7c54c/attachment.html>

Posted on the users mailing list.