From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from euclid.skiles.gatech.edu (list@euclid.skiles.gatech.edu [130.207.146.50]) by coral.primenet.com.au (8.7.5/8.7.3) with ESMTP id HAA15653 for ; Wed, 4 Sep 1996 07:03:49 +1000 (EST) Received: (from list@localhost) by euclid.skiles.gatech.edu (8.7.3/8.7.3) id QAA25021; Tue, 3 Sep 1996 16:26:39 -0400 (EDT) Resent-Date: Tue, 3 Sep 1996 16:26:39 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199609032025.WAA06763@bolyai.cs.elte.hu> Subject: autoloaded function behaviour To: zsh-workers@math.gatech.edu (Zsh workers list) Date: Tue, 3 Sep 1996 22:25:28 +0200 (MET DST) Organization: Dept. of Comp. Sci., Eotvos University, Budapest, Hungary Phone: (36 1)2669833 ext: 2667, home phone: (36 1) 2752368 X-Mailer: ELM [version 2.4ME+ PL16 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"-fRAm2.0.t66._H9Bo"@euclid> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/2103 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu There is a problem with the present function autoloading scheme. It is not a big problem, it just seems that it is too ksh compatible. As you all know zsh originally assumed that in the file it loads only the function body is stored while ksh simply executes the file in the current shell environment then executes the required function. To hack in ksh compatibility zsh first assumes that the file is the body of the function and executes this as a function. If the executed function is redefined during that process then it is executed again. This means that if a zsh function uses the old zsh way for autoloading and it redefines itself, the redefined function will be executed after the real function exits. The only way to prevent this is by using ksh-style autoloding. In that case there is no way to be compatible with both the original zsh and the ksh behaviour. This can be left as it is saying that it is a rare case with a workaround and actually I prefer. The only other solution I see now is to add a new option which forces the original zsh behaviour. Zoltan