From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25843 invoked by alias); 28 Jan 2015 03:21:49 -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: 34420 Received: (qmail 14142 invoked from network); 28 Jan 2015 03:21:46 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=p0znc8JZoXnZ4+Yzk/lQUj16o2EaKqGAxDeAPyiomZo=; b=fkNNjQxSh1iVmkMoBgUR0AXa8DZdKt/al5vnfTX5yIiTVPaM6CARFap192VVOLANIx Kxgc3NQCnRehMhT7KfjMcOGBpe0iuw8Aqh+hkYxSedSvUnPvLoKdejL+lsbjCcj5uELL XL4dBLh6NueBIRa8ciGuBWU/UUFZaSAx/NMfoWCJWDQtZ55o1oRQL4h2z2Z5w2VsvJyu KBS+onCgW8XHZqVYcEwjvGmuQBeUhJk1axZyZ1njLnMZYUgUi5GvtCqlq8gabIc2BIg2 lb+xq07vsRHz5vxNxh2bbDVRSCS52+qiHEipFKsmJS+AjVEtjl5oWZkttfqMJnv0xL0j kr/w== MIME-Version: 1.0 X-Received: by 10.42.111.5 with SMTP id s5mr1151762icp.79.1422415302576; Tue, 27 Jan 2015 19:21:42 -0800 (PST) In-Reply-To: <150126214831.ZM551@torch.brasslantern.com> 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> Date: Tue, 27 Jan 2015 22:21:42 -0500 Message-ID: Subject: Re: [PATCH] Enable further expansion of parameter name by ${!...} From: Tomoki Sekiyama To: Bart Schaefer Cc: "zsh-workers@zsh.org" Content-Type: text/plain; charset=UTF-8 2015-01-27 0:48 GMT-05:00 Bart Schaefer : > 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".) I agree. So until nameref is introduced, ${!aaa} should always be "aaa" 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. I'm not familiar with zsh policy to determine default behaviors, but if there is future plan (or possibility) to introduce nameref, we certainly should provide this bash-like indication under an option. For example: $ unsetopt banghist $ typeset -A foo $ foo[bar]=qux $ foo[baz]=piyo $ baz=BAZ $ echo ${foo[@]} qux piyo $ echo ${!foo[@]} bar baz $ setopt bashindirection $ echo ${!foo[bar]} BAZ $ emulate -R ksh $ echo ${!foo[bar]} foo[bar] Without these options, we might only support '!' for ${!foo[@]} getting arrays of the keys of foo. How do you think of this?