From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27601 invoked by alias); 11 Nov 2016 18:48:43 -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: X-Seq: 39919 Received: (qmail 20822 invoked from network); 11 Nov 2016 18:48:43 -0000 X-Qmail-Scanner-Diagnostics: from mail-vk0-f45.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.213.45):SA:0(-0.0/5.0):. Processed in 1.061063 secs); 11 Nov 2016 18:48:43 -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=-0.0 required=5.0 tests=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.213.45 as permitted sender) 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=J0keE7I0eRS6Yz10yTSMCUXPLJ1omSE4XT++hmSE+Ws=; b=BR2j+QXlDfK+Htwk7bKZU9S0YQ6i2fHX4E6qd1RwMVvlmzM+llZOnLS5Tx66o2k7uz ytgRIT+w21JiNyuhYDNf3I4DU0OySQtO0HgDLVMMsYzx6kBS6RFgegVpxRH4DTjiY4nQ N2SZGu2yC/zxrmXUJMMn1/paJNBT4DzQCWBtYuFFnatkCFHdWSSeU/Z5vbYeinkDj1Xv JDSlfv9wJT7AgwYgkByI/g7NxmPEKY/cJ2B2xavmT0y+3avQrYztQkvnuicToaYLOL9m EOjxdvxtQQNrextGvDqWv1EIdsU7flnQyDCpAP3nlYBW+zTLffgQg/zETIvjgCkd6y+K /Yig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version; bh=J0keE7I0eRS6Yz10yTSMCUXPLJ1omSE4XT++hmSE+Ws=; b=Nvt4lUb+eAJm+IucF5SuA44xsDNPp22AXOMwDzbDVh6PNd08GeIUZ2QL8jPavT6JhT V4ed0pbMef76p/UqVwV5XtapTN1AdY2qqc3m+ryG32TgO7oipI4P+ARBIzM6Gfr8Qge0 Z+eshzqnWrIMFQZD3grXTsLppeoPPuhwKBBdqHRDzHzV1Rd+lve2U5IOWw7O0o4yf6eA cnSsWq8toqKEouBVLoHY4GSH9FtUsEbIPfFymZdy9wsHlObLldOkW20uC9LVC3TsLA64 VZujRC687NNH9I3v+Ev64HoxvP/gTY5NDj+svcQXEuUiEfq2cRVWkJHv/vO5/xLrJ5Hv D9Rw== X-Gm-Message-State: ABUngvfG9/J3hD4pYIu05wqsOF8ltBtzv7eMXI2NAkxD7fHmUWUeA1qoECtJdbwQ7i287g== X-Received: by 10.31.244.9 with SMTP id s9mr2416766vkh.31.1478883517320; Fri, 11 Nov 2016 08:58:37 -0800 (PST) From: Bart Schaefer Message-Id: <161111085839.ZM29802@torch.brasslantern.com> Date: Fri, 11 Nov 2016 08:58:39 -0800 In-Reply-To: <150126214831.ZM551@torch.brasslantern.com> Comments: In reply to Bart Schaefer "Re: [PATCH] Enable further expansion of parameter name by ${!...}" (Jan 26, 9:48pm) References: <1422177338-85472-1-git-send-email-tomoki.sekiyama@gmail.com> <150125122410.ZM31619@torch.brasslantern.com> <10496951422218331@web21g.yandex.ru> <150125133931.ZM32124@torch.brasslantern.com> <150126214831.ZM551@torch.brasslantern.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: "zsh-workers@zsh.org" Subject: Re: [PATCH] Enable further expansion of parameter name by ${!...} MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Noticed patches related to this in my git stash. The thread dies out without an answer to the question of which default behavior to choose. I'll quote the entire year-old last substantive message for reference. On Jan 26, 2015, 9:48pm, Bart Schaefer wrote: } Subject: Re: [PATCH] Enable further expansion of parameter name by ${!...} } } On Jan 26, 3:00pm, Tomoki Sekiyama wrote: } } } } # ksh bash zsh(default) zsh(KSH) } } echo $aaa # bbb bbb bbb bbb } } echo ${!aaa} # aaa ccc bad substitution bbb } } OK, but the point is that ideally in that last row the zsh(KSH) case } would be "aaa". I guess this is no worse than the difference of } ${array[1]} with or without ksharrays set. (If "nameref aaa=bbb", } then the first column of the last row would be "bbb".) } } } # ksh bash zsh(default) zsh(KSH) } } echo ${!foo[bar]} # foo[bar] piyo bad substitution bar } } I find this one interesting, because the ksh doc says it "expands to the } name of the subscript" which would seem to me to fit the zsh(KSH) column } more than the ksh column. } } Ksh also has the special case ${!foo[bar..baz]} which treats the array } keys as an alphabetical list and generates a sub-list of them from "bar" } through "baz" (uninteresting in this example). } } } According to this, introducing bash-like behaviors instead of "bad } } substitution" error will not hurt zsh even in ksh emulation mode. } } My question is, why choose the bash behavior for the zsh default and } not the ksh behavior? If we make the bash behavior the default, then } also adding namerefs as a default leaves us deviating from ksh on the } meaning of ${!aaa} for identifiers that are not namerefs. The patch I have (workers/34390) implements the bash behavior as the default, without changing zsh's incorrect ksh emulation. Obviously we're nowhere close to adding namerefs, so maybe we should just punt on this until that happens.