From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25537 invoked from network); 11 Feb 2003 10:38:13 -0000 Received: from sunsite.dk (130.225.247.90) by ns1.primenet.com.au with SMTP; 11 Feb 2003 10:38:13 -0000 Received: (qmail 17252 invoked by alias); 11 Feb 2003 10:38:03 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 18222 Received: (qmail 17244 invoked from network); 11 Feb 2003 10:38:03 -0000 Received: from localhost (HELO sunsite.dk) (127.0.0.1) by localhost with SMTP; 11 Feb 2003 10:38:03 -0000 X-MessageWall-Score: 0 (sunsite.dk) Received: from [62.189.183.235] by sunsite.dk (MessageWall 1.0.8) with SMTP; 11 Feb 2003 10:38:3 -0000 Received: from exchange01.csr.com (unverified) by (Content Technologies SMTPRS 4.2.1) with ESMTP id for ; Tue, 11 Feb 2003 10:44:37 +0000 Received: from csr.com (tinky-winky.csr.com [192.168.144.127]) by exchange01.csr.com with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id DQ47MCWS; Tue, 11 Feb 2003 10:38:42 -0000 To: zsh-workers@sunsite.dk Subject: Re: set -A In-reply-to: "Oliver Kiddle"'s message of "Tue, 11 Feb 2003 09:45:38 +0100." <8132.1044953138@finches.logica.co.uk> Date: Tue, 11 Feb 2003 10:38:02 +0000 Message-ID: <3745.1044959882@csr.com> From: Peter Stephenson Oliver Kiddle wrote: > I'm inclined to agree that this is wrong. It would seem more logical to > me for an unset variable to be interpreted as an empty array when > retrieved in array context. >... > I've been aware of this for some while and had intended to change it if > I ever have time to finish work on the parameter code. Would changing > it break much? It would improve bash/ksh compatibility. I suspect it would improve matters in the particular case of `[@]' --- I see no occasion when someone would deliberately use that in the expectation it caused "$foo[@]" to turn into a zero-length string for an empty $foo of any type. However, note there is in general no such thing as `array context' in zsh, so we need to be careful with other subscripts. > A similar thing which I find annoying is > that local defines parameters to be scalar by default instead of > leaving their type undefined causing similar empty element problems. There's no such thing as an undefined type for a declared parameter, either, nor is it clear what that would mean. You have to declare it with a particular type. You need to declare it as `local -a' if you want it to behave as an array. I think the problem is few people have yet got into the habit of doing this (though increasing use of += makes it more necessary). -- Peter Stephenson Software Engineer CSR Ltd., Science Park, Milton Road, Cambridge, CB4 0WH, UK Tel: +44 (0)1223 692070 ********************************************************************** The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. **********************************************************************