all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Nic Ferrier <nferrier@ferrier.me.uk>
Cc: emacs-devel@gnu.org
Subject: Re: non-local exits with signal and condition-case
Date: Sun, 02 Jun 2013 20:02:16 -0400	[thread overview]
Message-ID: <jwvhahgf4uo.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87ehckjiyr.fsf@ferrier.me.uk> (Nic Ferrier's message of "Sun, 02 Jun 2013 22:33:48 +0100")

> 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 bug-gnu-emacs@gnu.org.


        Stefan



  reply	other threads:[~2013-06-03  0:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-02 16:24 non-local exits with signal and condition-case Nic Ferrier
2013-06-02 18:52 ` Stefan Monnier
2013-06-02 21:33   ` Nic Ferrier
2013-06-03  0:02     ` Stefan Monnier [this message]
2013-06-03 15:54     ` Davis Herring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvhahgf4uo.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=nferrier@ferrier.me.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.