From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16948 invoked from network); 11 Nov 2003 15:18:25 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Nov 2003 15:18:25 -0000 Received: (qmail 23605 invoked by alias); 11 Nov 2003 15:18:11 -0000 Mailing-List: contact zsh-users-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6759 Received: (qmail 23575 invoked from network); 11 Nov 2003 15:18:11 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 11 Nov 2003 15:18:11 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [193.109.254.211] by sunsite.dk (MessageWall 1.0.8) with SMTP; 11 Nov 2003 15:18:10 -0000 X-VirusChecked: Checked X-Env-Sender: okiddle@yahoo.co.uk X-Msg-Ref: server-2.tower-36.messagelabs.com!1068563889!1755684 X-StarScan-Version: 5.1.13; banners=.,-,- Received: (qmail 8981 invoked from network); 11 Nov 2003 15:18:09 -0000 Received: from iris.logica.co.uk (158.234.9.163) by server-2.tower-36.messagelabs.com with SMTP; 11 Nov 2003 15:18:09 -0000 Received: from gmcs3.local ([158.234.142.61]) by iris.logica.co.uk (8.12.3/8.12.3/Debian -4) with ESMTP id hABFI8Ab017017 for ; Tue, 11 Nov 2003 15:18:09 GMT Received: from gmcs3.local (localhost [127.0.0.1]) by gmcs3.local (8.11.6/8.11.6/SuSE Linux 0.5) with ESMTP id hABFLWQ11369 for ; Tue, 11 Nov 2003 16:21:32 +0100 X-VirusChecked: Checked X-StarScan-Version: 5.1.13; banners=-,-,- In-reply-to: <25969.1068547365@csr.com> From: Oliver Kiddle References: <25969.1068547365@csr.com> To: zsh-users@sunsite.dk Subject: Re: Completion function for bitkeeper? Date: Tue, 11 Nov 2003 16:21:32 +0100 Message-ID: <11367.1068564092@gmcs3.local> Peter wrote: > Oliver Kiddle wrote: > > compadd arguments aren't passed in $expl. They may coincidentally > > happen to be lying around in $expl but only because $expl was chosen as > > a place to have _description store them temporarily before passing them > > on. > > The subtlety of the distinction is a bit lost on me. Isn't that exactly > the problem Danek is worried about? I would only share Danek's worry if it was undefined as to where a function should go looking for compadd options passed to it. It isn't undefined - compadd options are only explicitly passed to other completion functions in the positional parameters. If we take this example: _foo() { local expl _description foo expl foos _bar "$expl[@]" } As a result of zsh having dynamic scoping, _foo's $expl is still visible inside _bar. _foo happens to use $expl for storing compadd options to pass on. Knowing this the author of _bar could take advantage of it but it'd be bad programming (and might break if _bar was called from elsewhere). To actively prevent it, we need static scoping. Does that make sense now? Oliver PS. As an aside, needing the expl parameter to _wanted is somewhat pointless. ________________________________________________________________________ This email has been scanned for all viruses by the MessageLabs Email Security System. For more information on a proactive email security service working around the clock, around the globe, visit http://www.messagelabs.com ________________________________________________________________________