Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Why are empty elements removed from array expansion?
- X-seq: zsh-users 15671
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh Users <zsh-users@xxxxxxx>
- Subject: Re: Why are empty elements removed from array expansion?
- Date: Thu, 23 Dec 2010 00:07:50 -0800
- In-reply-to: <AANLkTinMeP3zq_9vE12-PH7wkAJ9emQ5FcorU4B1po7u@xxxxxxxxxxxxxx>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <AANLkTik5Lc-57VHSkwOE6v2q=tM24N_0DWbXgTsrATDp@xxxxxxxxxxxxxx> <101222230927.ZM21944@xxxxxxxxxxxxxxxxxxxxxx> <AANLkTinMeP3zq_9vE12-PH7wkAJ9emQ5FcorU4B1po7u@xxxxxxxxxxxxxx>
On Dec 23, 8:21am, Nikolai Weibull wrote:
} Subject: Re: Why are empty elements removed from array expansion?
}
} > This is thus a "principle of least surprise" issue -- not what least
} > surprises *you*, as a programmer expecting certain rigid rules, but
} > what least surprises an inexpert shell user trying to figure out why
} > "cat $a" says that the empty string can't be opened as a file.
}
} It's sad that I have to pay the tax for such users.
That you realize it is a tax, makes you the right person to pay it.
} Is this the same reasoning behind the fact that empty string variables
} are removed as arguments as well?
Yep.
} This is, speaking as a programmer, perhaps even worse.
Zsh has always been [*] organized such that the stuff that will least
confuse a newbie, or will save the most keystrokes when whipping out
an everyday interactive command line, has the most obvious syntax; and
so the power tools for serious script programmers are concealed behind
syntax that could never occur by accident.
[*] Or tried to be, not always entirely successfully. The rule that
most often defeats this is that nothing old is allowed to break when
adding something new.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author