Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Why are empty elements removed from array expansion?



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