From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10175 invoked from network); 16 Jan 2009 17:36:12 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00 autolearn=ham version=3.2.5 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 16 Jan 2009 17:36:12 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 16764 invoked from network); 16 Jan 2009 17:36:06 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 16 Jan 2009 17:36:06 -0000 Received: (qmail 19918 invoked by alias); 16 Jan 2009 17:36:01 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 26321 Received: (qmail 19898 invoked from network); 16 Jan 2009 17:36:00 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 16 Jan 2009 17:36:00 -0000 Received: from QMTA02.westchester.pa.mail.comcast.net (qmta02.westchester.pa.mail.comcast.net [76.96.62.24]) by bifrost.dotsrc.org (Postfix) with ESMTP id B7E7E80271F0 for ; Fri, 16 Jan 2009 18:35:47 +0100 (CET) Received: from OMTA08.westchester.pa.mail.comcast.net ([76.96.62.12]) by QMTA02.westchester.pa.mail.comcast.net with comcast id 4ANG1b0090Fqzac52HbnkY; Fri, 16 Jan 2009 17:35:47 +0000 Received: from smtp.klanderman.net ([98.217.254.247]) by OMTA08.westchester.pa.mail.comcast.net with comcast id 4Hbd1b00A5M2Np63UHbdCa; Fri, 16 Jan 2009 17:35:37 +0000 Received: from lwm.klanderman.net (unknown [192.168.100.50]) by smtp.klanderman.net (Postfix) with ESMTP id 64BECB30144 for ; Fri, 16 Jan 2009 12:35:45 -0500 (EST) Received: by lwm.klanderman.net (Postfix, from userid 500) id 41D399FC5E5; Fri, 16 Jan 2009 12:35:45 -0500 (EST) From: Greg Klanderman To: zsh-workers@sunsite.dk Subject: Re: treatment of empty strings - why is this not a bug? Reply-To: gak@klanderman.net Date: Fri, 16 Jan 2009 12:35:45 -0500 In-Reply-To: <090115201912.ZM20275@torch.brasslantern.com> (Bart Schaefer's message of "Thu, 15 Jan 2009 20:19:12 -0800") Message-ID: User-Agent: Gnus/5.1007 (Gnus v5.10.7) XEmacs/21.4.17 (linux) References: <18796.17298.94642.461735@gargle.gargle.HOWL> <090115201912.ZM20275@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: ClamAV 0.92.1/8871/Fri Jan 16 05:16:59 2009 on bifrost X-Virus-Status: Clean >>>>> Bart Schaefer writes: > I was hoping to just let this thread go by, but maybe I'm the only one > still on list who's been around long enough to have an inkling of what > is going on here. Hi Bart, thank you for responding to this question. I hope you and/or Peter will entertain one more round of this thread and answer my final two questions, then I'll happily drop it if you wish. > Paul Falstad (original author of zsh) made a conscious decision that > a non-empty string, even one containing some or only characters that > appear in $IFS, was a significant item of data and should remain in > the expansion of $@. However, he was unwilling to deviate from the > standard semantics of $@ to the point of treating empty strings as > significant. I almost think it's worse this way - you read the docs and think "Oh great, I don't have to worry about putting all those crazy double quotes around everything anymore to preserve my array elements", however, you in fact do still need all those double quotes. > Too many programs that deal with file names, for example, > would begin spewing errors if they received empty strings in their > argument lists when called as e.g. ls -l $@. I don't understand how empty strings get into arrays unless one explicitly puts them there.. and if one explicitly puts them there, then presumably they don't want them randomly dropped. The best reason I can come up with for this semantics is having code like this continue to work: foo_arg="" if [[ ... ]] ; then foo_arg="-bar" fi foo $foo_arg However, now that our shell has arrays, that should really be written as: foo_arg=() if [[ ... ]] ; then foo_arg=("-bar") fi foo $foo_arg and so I see no remaining need for dropping empty strings. > The point is to be minimally surprising to the person who just doesn't > want to think very hard about array and $IFS semantics, not to be > entirely logically consistent to someone who analyzes the behavior in > detail. If you're enough of a geek to care, you're also enough of a > geek to figure out a workaround. Sure, I can keep using double quotes, but I don't want to given how close zsh is to DTRT and not needing them. You and Peter seem to be in charge here - do you both still agree that dropping empty strings is a desirable default? Would you guys be OK with adding an option to inhibit this? thank you, Greg