[racket] raise-ing an exception inside prompt

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Wed Dec 22 12:46:49 EST 2010

No, prompt doesn't do that.

This boils down to what the default uncaught-exception-handler does, which is:

  (abort-current-continuation (default-continuation-prompt-tag) void)

The relevant docs are in raise, with-exception-handler, and
uncaught-exception-handler.

Robby

On Wed, Dec 22, 2010 at 11:35 AM, Carl Eastlund <cce at ccs.neu.edu> wrote:
> It looks like prompt installs its own exception handler.  So the 3
> gets caught and reported by prompt, which then returns a default value
> of void and the call to + continues.  This bears out with other
> examples, such as (list (prompt (raise 3))), which returns a list
> containing void.
>
> Carl Eastlund
>
> On Wed, Dec 22, 2010 at 12:28 PM, Keiko Nakata
> <keiko at kurims.kyoto-u.ac.jp> wrote:
>> I'm not sure if I got your point, as I seem to have the same result
>> after replacing with displayln.
>>
>> My concern is why I get a type error only for the latter?
>> (And how I could get both the exception and type error?)
>>
>> Keiko
>>
>>
>> From: Matthias Felleisen <matthias at ccs.neu.edu>
>> Subject: Re: [racket] raise-ing an exception inside prompt
>> Date: Wed, 22 Dec 2010 12:15:21 -0500
>>
>>>
>>> Replace print with displayln. (You're buffering the output but it isn't displayed until the repl prints the next prompt.)
>>>
>>>
>>> On Dec 22, 2010, at 11:56 AM, Keiko Nakata wrote:
>>>
>>> > Hello,
>>> >
>>> > How should I understand this behavior?
>>> >
>>> > (with-handlers ([(lambda (_) #t) (lambda (_) (print "exit"))])
>>> >  (print (+ (prompt (print "hi") (raise 3) (print "bye")) 10)))
>>> >
>>> > prints "hi" then "exit", whereas
>>> >
>>> > (+ (prompt (print "hi") (raise 3) (print "bye")) 10)
>>> >
>>> > prints "hi", then I got an uncaught exception, followed by type error
>>> > of adding <void> and 10.
>>> >
>>> > Btw, where can I find the source code around exceptions,
>>> > e.g., raise and with-handlers?
>>> >
>>> > Thanks,
>>> > Keiko
> _________________________________________________
>  For list-related administrative tasks:
>  http://lists.racket-lang.org/listinfo/users
>


Posted on the users mailing list.