From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8798 invoked by alias); 6 Mar 2018 17:02:34 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: List-Unsubscribe: X-Seq: 42427 Received: (qmail 8404 invoked by uid 1010); 6 Mar 2018 17:02:34 -0000 X-Qmail-Scanner-Diagnostics: from mail-pl0-f41.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.160.41):SA:0(-1.9/5.0):. Processed in 0.519719 secs); 06 Mar 2018 17:02:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=dzszmeMcm48n26oJZbPWI6rtrcl4V7SJEfu4F7h8lgE=; b=ulYil1ezXnPVTNCDgtiMXsTqaPPuShv9N9Gy8D5oVFH0z2BaJArgL2RHYagh3LywzO li7YQjyooW5bojvxjM/onaE4AtdU6sKMnyxAFrbBZTTs9fuwWk29EWGu6h6BagG/Iypm caqe86KDtX5/dVVqE7KzDh3aAhTJP871JcUxL/msJOYKnNuA/ifthDZpITK/vObzVFOa j5aGrGWbA/nPt6wWuLinb5QfBTcN4XJos1Y3XnTPiIX7lIZCvu1RZVfXo+pCHnJ067+s hvFNuq6SWr8ouvLB9RcsT+alxWSDKzViTM+TfAm1qAE9Sf3Q2ckq3PGRhBUTfY4H6a4Y oIeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=dzszmeMcm48n26oJZbPWI6rtrcl4V7SJEfu4F7h8lgE=; b=mHwmRxlZKw/0rDfYMlfPrBX8D6clQyeq4qhqkF/5mBVNsI88PwRP7nLkR78goIPySx KtFluY0fyAXz9WRR++q+dfxWVBtDDAquWNk1uNK2mr9PpS/cfdyiQuV5TrA4T97K9I14 W9jJ/hYwb3NdIkLfcTcW+/qFGHX3zHzLajlGGUpTTkBf76VQZjB/zYfTutZHn3rvsSxi Li8NjiV8C60kSAkPr1Zij1otQr3QhApzhoQkGEj6Im3/3BmZXT6nMJ0jBpqMp4Kj1OE2 ks79/Tfq65G5nRoO0DHlqk5GZjrlDyIJjDaYuuQjFYdNkHBA9hyNBnnObwQmL7H2fKqv nfXQ== X-Gm-Message-State: APf1xPBqTua1/GNygqZcPmM/4Kok19PHq4tXepSzu9OMxbuAaZiI8n8C kQWx3IGaqBIlDDHuAkD8tJk3iS1s X-Google-Smtp-Source: AG47ELtMxqF5N8KLaYTziPtSM/VNBZQhnyEPhHcMXaZ2MOjEFi1Te4a8vONQjKEQogLHKy787HDQjw== X-Received: by 2002:a17:902:2904:: with SMTP id g4-v6mr17118683plb.170.1520355751129; Tue, 06 Mar 2018 09:02:31 -0800 (PST) From: Bart Schaefer Message-Id: <180306090231.ZM28167@torch.brasslantern.com> Date: Tue, 6 Mar 2018 09:02:31 -0800 In-Reply-To: <20180306151644.GA10296@chaz.gmail.com> Comments: In reply to Stephane Chazelas "issues with ${array[x][y]}" (Mar 6, 3:16pm) References: <20180306151644.GA10296@chaz.gmail.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Stephane Chazelas , Zsh hackers list Subject: Re: issues with ${array[x][y]} MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Mar 6, 3:16pm, Stephane Chazelas wrote: } Subject: issues with ${array[x][y]} } } $ a=(foo bar) } $ x='a[1][1]' } $ echo ${(P)x} } foo This is happening because ${{(P)var}[1]} must treat ${(P)var} as an array any time the name referred to by $var is an array, so array-ness is being preserved when doing the first a[1] dereference. } There's also a consistency issue in that one can do: } } string[1]=x } } and reference ${array[1][1]} } } but: } } $ a[1][1]=b } zsh: no matches found: a[1][1]=b Having ${array[1][1]} is mostly for convenience, because it dates from before ${${array[1]}[1]} would have been syntactically valid. It was never intended to work as an assignment.