unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Andy Moreton <andrewjmoreton@gmail.com>
Cc: 16402@debbugs.gnu.org
Subject: bug#16402: 24.3.50; Document nadvice.el stuff in Elisp manual before Emacs 24.4
Date: Fri, 10 Jan 2014 09:42:50 -0500	[thread overview]
Message-ID: <jwvmwj3diqy.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <86r48glgbt.fsf@gmail.com> (Andy Moreton's message of "Fri, 10 Jan 2014 02:29:42 +0000")

> A rationale to explain why the existing advice package needs changing
> would also be helpful.

Here are some of the reasons:
- I implemented add-function, which is a different feature not provided
  by advice.el.
- implementing advice-add on top of the add-function code takes just 8KB.
- by contrast advice.el was 150KB (now reduced to 130KB by using nadvice.el).
- once add-function is documented, documenting advice-add is similarly
  much simpler than defadvice.
- advice-add fixes several problems in defadvice:
  - the fact that defadvice does not expand macros in its code unless
    you explicitly ask for the advice to be compiled.
  - the fact that defadvice only compiles either too early (via the
    "precompilation", which is rarely used and rightly so) or too late
    (when activating the advice), so you typically won't get any
    byte-compiler warnings.
  - ad-do-it and ad-return-value in `around' advice don't work the way
    people intuitively expect them to.
  - ad-activate and ad-deactivate have global effects (i.e. they affect
    all advices applied to that symbol), so any use of those within
    a package is a bug in the waiting.
  - the distinction between enabling/disabling and
    activating/deactivating is "too subtle" for the users of defadvice:
    it's really just a reflection of the underlying implementation.
  - advice.el is much too large to be preloaded, so for example debug.el
    refrained from using it.
    
> As an aside, storing raw bytecode in advice--where-alist seems hackish.

Agreed.

> Is it not possible to construct this byte code from something more
> human readable at compile time ?

It's possible, but the pre-existing code which does something like that
is in the byte-compiler and does not provide quite the right feature.
It didn't seem worth the trouble to restructure that code just for that
one use.


        Stefan





  parent reply	other threads:[~2014-01-10 14:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-09  6:06 bug#16402: 24.3.50; Document nadvice.el stuff in Elisp manual before Emacs 24.4 Drew Adams
2014-01-09  6:21 ` Glenn Morris
2014-01-09 16:01 ` Stefan Monnier
2014-01-10  2:29   ` Andy Moreton
2014-01-10  3:28     ` Leo Liu
2014-01-10  3:39       ` Daniel Colascione
2014-01-10  4:18         ` Drew Adams
2014-01-10  4:19         ` Leo Liu
2014-01-10 14:42     ` Stefan Monnier [this message]
2014-01-10 15:15       ` Drew Adams
2014-01-10 21:21         ` Daniel Colascione
2014-01-10 21:50           ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwvmwj3diqy.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=16402@debbugs.gnu.org \
    --cc=andrewjmoreton@gmail.com \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).