This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: catch/throw functionality


Per Bothner <bothner@cygnus.com> writes:

> The Guile reference manual describes catch and throw.
> Are these interfaces considered stable?  Or are any changes
> planned?

I think Jim should answer this, but I know of no changes.

> There is one feature I fail to see the point of:
> 
>      Key may also be the value `#f'.  In that case, THUNK takes one
>      argument which will be passed a "jump buffer object".  A jump
>      buffer object may be used as the key argument to `throw' to throw
>      to a specific `catch' without an intervening search for a symbolic
>      key.
> 
> Assuming you have a gensym function that returns an unique symbol,
> am I right in believing that:
> 	(catch #f THUNK HANDLER)
> is equivalent to:
> 	(let ((jbuf (gensym))) (catch jbuf (lambda () (THUNK jbuf)) HANDLER))

You're right.

> If so, then it seems like a feature that fail to justify the extra
> conceptual complication to catch.  (I can implement it easily enough.
> It is just very ugly, in a type sense.)

I agree.  I'll remove this feature if no-one stops me within a few days.

/mdj