From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27187 invoked from network); 22 Jun 1999 16:14:33 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 22 Jun 1999 16:14:33 -0000 Received: (qmail 8861 invoked by alias); 22 Jun 1999 16:14:24 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 6787 Received: (qmail 8852 invoked from network); 22 Jun 1999 16:14:24 -0000 From: "Andrej Borsenkow" To: "ZSH workers mailing list" Subject: Possible bug with ${(A)foo=} and ${(AA)foo=} Date: Tue, 22 Jun 1999 20:13:44 +0400 Message-ID: <007a01bebcca$33379950$21c9ca95@mow.siemens.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="koi8-r" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-Mimeole: Produced By Microsoft MimeOLE V5.00.2314.1300 While playing with something else I discovered, that it is impossible to create empty array with this form and it is impossible to create hash in this way without error message: bor@itsrm2:~%> unset foo bor@itsrm2:~%> : ${(A)foo=} bor@itsrm2:~%> print ${#foo} 1 bor@itsrm2:~%> unset foo bor@itsrm2:~%> : ${(A)foo=""} bor@itsrm2:~%> print ${#foo} 1 bor@itsrm2:~%> unset foo bor@itsrm2:~%> : ${(AA)foo=""} zsh: bad set of key/value pairs for associative array bor@itsrm2:~%> print ${#foo} 0 bor@itsrm2:~%> : ${(AA)foo=} zsh: bad set of key/value pairs for associative array bor@itsrm2:~%> print ${#foo} 0 I think, that if ${foo=} is valid at all, then we must distinguish between no value and empty value. It is the same as in command line (and, after all, we compute it using the same rules?) - empty value is lost but explict NULL like "" is retained. In other words, ${(A)foo=} - creates empty array ${(A)foo=""} - creates array with one element of length 0 ${(AA)foo=} - creates empty hash ${(AA)foo=""} - is invalid assignment as expected [Background - ${(AA)foo=} seems currently to be the only way to create global hash from within Zsh function] /andrej