From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: Things I would like to be added after the release Date: Mon, 18 Jun 2007 12:25:07 +0900 Message-ID: <87hcp6aqr0.fsf@uwakimon.sk.tsukuba.ac.jp> References: <86fy5ghs0s.fsf@lola.quinscape.zz> <18035.28326.988640.435412@gargle.gargle.HOWL> <18036.29770.79749.537013@gargle.gargle.HOWL> <87645nsbln.fsf@catnip.gol.com> <18037.30905.922391.769587@gargle.gargle.HOWL> <18037.38487.604684.804719@kahikatea.snap.net.nz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1182136493 27365 80.91.229.12 (18 Jun 2007 03:14:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 18 Jun 2007 03:14:53 +0000 (UTC) Cc: rms@gnu.org, klaus.berndl@sdm.de, joakim@verona.se, emacs-devel@gnu.org, raman@users.sourceforge.net, miles@gnu.org To: Nick Roberts Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jun 18 05:14:51 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1I07ha-0006pT-Ot for ged-emacs-devel@m.gmane.org; Mon, 18 Jun 2007 05:14:51 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I07ha-0006SA-6V for ged-emacs-devel@m.gmane.org; Sun, 17 Jun 2007 23:14:50 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1I07hN-0006N8-Ip for emacs-devel@gnu.org; Sun, 17 Jun 2007 23:14:37 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1I07hL-0006ML-UH for emacs-devel@gnu.org; Sun, 17 Jun 2007 23:14:37 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1I07hL-0006MH-RK for emacs-devel@gnu.org; Sun, 17 Jun 2007 23:14:35 -0400 Original-Received: from mtps02.sk.tsukuba.ac.jp ([130.158.97.224]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1I07hJ-0002KA-TM; Sun, 17 Jun 2007 23:14:34 -0400 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mtps02.sk.tsukuba.ac.jp (Postfix) with ESMTP id 822A67FFC; Mon, 18 Jun 2007 12:14:31 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id EFB281A260D; Mon, 18 Jun 2007 12:25:07 +0900 (JST) In-Reply-To: <18037.38487.604684.804719@kahikatea.snap.net.nz> X-Mailer: VM 7.17 under 21.5 (beta27) "fiddleheads" (+CVS-20070324) XEmacs Lucid X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:73204 Archived-At: 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.