From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13536 invoked by alias); 20 Dec 2014 05:17:33 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19621 Received: (qmail 2886 invoked from network); 20 Dec 2014 05:17:29 -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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:content-type:mime-version :subject:from:in-reply-to:date:cc:content-transfer-encoding :message-id:references:to; s=smtpout; bh=9mIPzfYroicY3qtGVnhLNYX 2Zy0=; b=KF4op74u8+6AkVtn1u7DW2fZ2x8cCZ3XDoWNAwr6Lo8O/BUkF16yO3V HDTPelbe0NJvMK4J8O4VcW/xqZ237lSdBhtGTnCFQbTp1r5YJ7QnvBOm836NM5aX jwdSSJB1MRJAA4h1KteaVyNAZcZN53OojZX6ix8qWIwoHNEGLfNo= X-Sasl-enc: jeqLjle6YY2jzB/vCB4IXCTNFWKTszxZQpVM9vrMy8Mh 1419052089 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Subject: Re: surprise with echo From: =?utf-8?Q?Lawrence_Vel=C3=A1zquez?= In-Reply-To: <5494F332.7000008@eastlink.ca> Date: Sat, 20 Dec 2014 00:08:07 -0500 Cc: zsh-users@zsh.org Content-Transfer-Encoding: quoted-printable Message-Id: References: <54937E5B.2020008@eastlink.ca> <141218190653.ZM16331@torch.brasslantern.com> <20335.1418988086@thecus.kiddle.eu> <5494F332.7000008@eastlink.ca> To: Ray Andrews X-Mailer: Apple Mail (2.1993) On Dec 19, 2014, at 10:55 PM, Ray Andrews = wrote: > My two cents would be (well, er, my 1/2 cent), that it should be the = default, *but* that the little surprise should not be there I believe Kurtis was saying that RC_QUOTES should be enabled by default, = not RC_EXPAND_PARAM. Having array substitution be distributive by default would be much more = of a "little surprise" at this point. > b) because it seems harsh to kill an entire string because one element = in it is null. You still don't understand what's going on. The expansion only results = in a null result *if the array itself is empty*. Null *elements* do not = produce the same behavior. % emulate zsh && setopt RC_EXPAND_PARAM % foo=3D() % echo aaa${foo}bbb % foo=3D('') % echo aaa${foo}bbb aaabbb % foo=3D('' '' '') % echo aaa${foo}bbb aaabbb aaabbb aaabbb % > c) Because the doctrine of least surprise should be followed. Agreed. That's why enabling RC_EXPAND_PARAM by default should never = happen. > OTOH Bart just showed how the surprise can be avoided so .... It's only a surprise if you enable the option without understanding what = it does first. I actually think that zsh's behavior is more consistent = and sensible. Why does it make sense to treat an empty array in the same = way as an array consisting of a single null element? Do you treat null = sets that cavalierly? Consider this contrived-ish example: % include_dirs=3D(/opt/local/include /usr/include = /usr/local/include) % clang -I${include_dirs} test.c The expansion here would be "clang -I/opt/local/include -I/usr/include = -I/usr/local/include test.c". But: % include_dirs=3D() % clang -I${include_dirs} test.c What would be the point of this expanding to "clang -I test.c"? It seems = entirely reasonable to drop that word entirely and expand to "clang = test.c", which is what actually happens. vq=