[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: non-local exits with signal and condition-case
From: |
Stefan Monnier |
Subject: |
Re: non-local exits with signal and condition-case |
Date: |
Sun, 02 Jun 2013 20:02:16 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> This is a heavily simplified version of something I just wrote for the
> new elnode based emacswiki:
Oh, I misunderstood, then: you're simulating "exceptions", which are
called "signals" in Elisp, so you definitely want to use `signal' and
`condition-case' here, rather than catch/throw.
The only inconvenient is that signal names are global, so you need to
use a name of the form "<prefix>-redirect". I guess you could use an
uninterned signal name, but it might be tricky to make use of that in
a convenient way.
>> You probably want to cons `errv' in front of inherits-list.
> I thought about that before I sent it - I think you are probably
> right. But my understanding is that you don't need the symbol to be
> present; you can disassociate the symbol used to send the signal from
> the symbol(s) used to capture it.
Yes, if you don't put `errv' in there, indeed you dissociate the two, so
you can't catch an "errv" with "errv" but only with one of its parents.
> I think (as you suggest) a define-signal form should probably not
> support that directly because it seems quite counter intuitive.
Exactly. While it's technically possible, no signal does that and
I can't think of any situation where someone would want to make use of
such a "feature". So it's more likely to be a source of bugs and
bug-reports than anything else.
>> We could add it to subr.el (tho I'd call it define-signal).
> Shall I send patches then?
Yes. Please send them to address@hidden
Stefan