From xemacs-m  Thu May  1 19:55:58 1997
Received: from Nimbus.CAM.ORG (Nimbus.CAM.ORG [198.168.100.4])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id TAA07905
	for <xemacs-beta@xemacs.org>; Thu, 1 May 1997 19:55:56 -0500 (CDT)
Received: from marcpa (marcpa.HIP.CAM.ORG [205.151.117.79])
          by Nimbus.CAM.ORG (8.8.4/8.8.4) with ESMTP
	  id UAA29778; Thu, 1 May 1997 20:55:52 -0400 (EDT)
Message-ID: <33693A95.C1480F7@cam.org>
Date: Thu, 01 May 1997 20:51:33 -0400
From: Marc Paquette <marcpa@cam.org>
X-Mailer: Mozilla 4.0b3 [en] (WinNT; I)
MIME-Version: 1.0
To: Bill Dubuque <wgd@martigny.ai.mit.edu>
CC: steve@miranova.com, xemacs-beta@xemacs.org
Subject: Re: Optional BUFFER arguments in functions; `with-current-buffer'
X-Priority: 3 (Normal)
References: <199705010552.AA183495939@martigny.ai.mit.edu>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Bill Dubuque wrote:
> 
> Steven L Baur <steve@miranova.com> wrote:
> |
> | Hrvoje Niksic <hniksic@srce.hr> writes:
> | >
> | > How hard is it to port `with-current-buffer', anyway.
> | > I might take a look at it.
> |
> | If I understand correctly, his implementation involves hacking the
> | bytecompiler which is supposed to make it fast.
> 
> Even if you support with-current-buffer via a byte-code operation
> it will still be MUCH slower than something like
> 
>   (buffer-substring start end buffer)
> 
> because the former does NOT need to bind all the buffer-local
> variables, etc.
> 
> Also, there were some good reasons Ben introduced the explicit
> buffer args, I think because there were lots of subtle bugs
> in the (C?) code due to it not being explicit which buffer certain
> commands were operating on ... search the archives to be sure.
> 
> I think this issues deserves further discussion.

Agreed.  I have bad feelings about backstepping changes like that.

My opinion, for what it's worth, is that explicit buffer args are a good
thing.  Everytime I wrote some non-trivial piece of elisp, I welcomed
the presence of these explicit buffer args: it seems much more natural
to me than having to rely on the implicit notion of (current-buffer). 
For example, I have often written code that, while principally acting on
a buffer (which is the current one), is getting some text from another
buffer, for which I have the buffer object in a variable.  In that case,
it always seemed cleaner to me to do 

	(insert (buffer-subsring a b buf))

I would like to understand why most people agree that dynamic scoping is
difficult to understand and should be avoided when possible, but are
advocating the perpetuation of `with-current-buffer' thingy, which looks
strangely like dynamic-scoping disguised ?
 
-- 
Marc Paquette
marcpa@cam.org

