From: "Stephen J. Turnbull" <stephen@xemacs.org>
To: Nick Roberts <nickrob@snap.net.nz>
Cc: rms@gnu.org, klaus.berndl@sdm.de, joakim@verona.se,
emacs-devel@gnu.org, raman@users.sourceforge.net, miles@gnu.org
Subject: Re: Things I would like to be added after the release
Date: Mon, 18 Jun 2007 12:25:07 +0900 [thread overview]
Message-ID: <87hcp6aqr0.fsf@uwakimon.sk.tsukuba.ac.jp> (raw)
In-Reply-To: <18037.38487.604684.804719@kahikatea.snap.net.nz>
Nick Roberts writes:
> T. V. Raman writes
>> I'm also speaking from my own experience of maintaining a rather
>> large package that is mostly built on advice. And using pre/post
>> command hooks to implement it I believe would have made the
>> codebase impossible to maintain.
> I think you're talking of maintaining a package outside of Emacs while
> others are talking about doing it _within_ Emacs.
No, he's talking about using advice rather than hooks. As we've seen
recently with menu items, callbacks are prone to being implemented as
lambdas which are undocumented except by their source, hard to debug,
and you don't know they are there unless you look specifically at the
hook variable (not the function doc! ... it would be a good idea to
fix that). By contrast, advice automatically documents that the
function is advised, and automatically displays the docstring that
tells you what changes have been made to behavior.
More fundamentally, advice (as a class of derived function) follows a
stack discipline, and can be read from the outside in, stopping when
you reach a function you fully understand. By contrast, hooks (again,
as a class) are totally undisciplined; you must read the source of
*all* functions on the hook, you must worry about interactions due to
varying order in different instances, and you must read the source of
the function using the hook to understand it in full.
Of course I'm telling only a partial story here, emphasizing the
advantages of advice over hooks. But it does have advantages, and
AFAICS the jury is still out on whether those can outweigh the
disadvantages.
next prev parent reply other threads:[~2007-06-18 3:25 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-28 9:04 Things I would like to be added after the release joakim
2007-05-29 0:02 ` Richard Stallman
2007-05-29 8:02 ` joakim
2007-05-29 9:36 ` klaus.berndl
2007-05-29 9:52 ` Michael Albinus
2007-05-29 9:56 ` David Kastrup
2007-06-16 5:01 ` T. V. Raman
2007-06-16 18:50 ` Richard Stallman
2007-06-16 23:37 ` T. V. Raman
2007-06-16 23:50 ` Miles Bader
2007-06-17 18:08 ` T. V. Raman
2007-06-17 20:15 ` Nick Roberts
2007-06-18 3:25 ` Stephen J. Turnbull [this message]
2007-06-18 21:31 ` Richard Stallman
2007-06-21 7:29 ` T. V. Raman
2007-06-21 8:09 ` Stefan Monnier
2007-06-17 8:54 ` Richard Stallman
2007-06-17 12:47 ` Stefan Monnier
2007-06-17 16:00 ` joakim
2007-05-29 10:02 ` joakim
2007-05-29 10:16 ` David Kastrup
2007-06-02 2:54 ` Richard Stallman
2007-06-04 0:17 ` Richard Stallman
2007-06-04 0:17 ` Richard Stallman
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=87hcp6aqr0.fsf@uwakimon.sk.tsukuba.ac.jp \
--to=stephen@xemacs.org \
--cc=emacs-devel@gnu.org \
--cc=joakim@verona.se \
--cc=klaus.berndl@sdm.de \
--cc=miles@gnu.org \
--cc=nickrob@snap.net.nz \
--cc=raman@users.sourceforge.net \
--cc=rms@gnu.org \
/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.