[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Things I would like to be added after the release
From: |
Stephen J. Turnbull |
Subject: |
Re: Things I would like to be added after the release |
Date: |
Mon, 18 Jun 2007 12:25:07 +0900 |
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.
- Re: Things I would like to be added after the release, Richard Stallman, 2007/06/01
- Re: Things I would like to be added after the release, Richard Stallman, 2007/06/03
- Re: Things I would like to be added after the release, Richard Stallman, 2007/06/03
- Re: Things I would like to be added after the release, T. V. Raman, 2007/06/16
- Re: Things I would like to be added after the release, Richard Stallman, 2007/06/16
- Re: Things I would like to be added after the release, T. V. Raman, 2007/06/16
- Re: Things I would like to be added after the release, Miles Bader, 2007/06/16
- Re: Things I would like to be added after the release, T. V. Raman, 2007/06/17
- Re: Things I would like to be added after the release, Nick Roberts, 2007/06/17
- Re: Things I would like to be added after the release,
Stephen J. Turnbull <=
- Re: Things I would like to be added after the release, Richard Stallman, 2007/06/18
- Re: Things I would like to be added after the release, T. V. Raman, 2007/06/21
- Re: Things I would like to be added after the release, Stefan Monnier, 2007/06/21
- Re: Things I would like to be added after the release, Richard Stallman, 2007/06/17
Re: Things I would like to be added after the release, Stefan Monnier, 2007/06/17