From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21699 invoked from network); 1 Jun 2001 15:03:03 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 1 Jun 2001 15:03:03 -0000 Received: (qmail 4915 invoked by alias); 1 Jun 2001 15:02:50 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14662 Received: (qmail 4890 invoked from network); 1 Jun 2001 15:02:49 -0000 From: "Bart Schaefer" Message-Id: <1010601150158.ZM19978@candle.brasslantern.com> Date: Fri, 1 Jun 2001 15:01:58 +0000 In-Reply-To: <200106011339.PAA14041@beta.informatik.hu-berlin.de> Comments: In reply to Sven Wischnowsky "Re: parameter substitution used in _values" (Jun 1, 3:39pm) References: <200106011339.PAA14041@beta.informatik.hu-berlin.de> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh-workers@sunsite.dk Subject: Re: parameter substitution used in _values MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Jun 1, 3:39pm, Sven Wischnowsky wrote: } Subject: Re: parameter substitution used in _values } } The problem is that the positional parameters are internally turned into } `$argv[n]'. This is a bit strange on many levels: zsh% noargv() { unset argv } zsh% showargv() { function> echo 1=$1 2=$2 @=\($@\) argv=\($argv\) $+argv function> noargv function> echo 1=$1 2=$2 @=\($@\) argv=\($argv\) $+argv function> unset argv function> echo 1=$1 2=$2 @=\($@\) argv=\($argv\) $+argv function> } zsh% showargv a b c d 1=a 2=b @=(a b c d) argv=(a b c d) 1 1=a 2=b @=(a b c d) argv=() 0 1= 2= @=() argv=() 0 So `unset argv' somehow did something with a param that was already unset. Now run `showargv' a second time in the same shell: zsh% showargv d c b a 1=d 2=c @=(d c b a) argv=() 0 1=d 2=c @=(d c b a) argv=() 0 1= 2= @=() argv=() 0 This is sort of documented: argv Same as *. Assigning to argv changes the local positional parameters, but argv is *not* itself a local parameter. Deleting argv with unset in any function deletes it everywhere, although only the innermost positional parameter array is deleted (so * and @ in other scopes are not affected). It seems a bit odd that `unset argv' continues to have side effects after argv has already been "deleted" but I guess that's just part of it being pecial. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net