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

Re: Disabling null elision (was: Re: Most Recent File)



On Mon, Oct 25, 2021 at 12:45 PM Daniel Shahaf <d.s@xxxxxxxxxxxxxxxxxx> wrote:
>
> Roman Perepelitsa wrote on Sun, Oct 24, 2021 at 09:22:46 +0200:
> > > It's one of the nice things about zsh that you can use the shorter
> > $foo and $#foo instead of "${foo[@]}" and ${#foo[@]}. I wish there was
> > an option to disable null elision with a corresponding expansion flag
> > to turn it on similar to no_sh_word_split and ${(=)name}

Note there isn't a ${(=)name}, it's just $=name or ${=name}.

> On the one hand, null elision breaks the principle of least surprise

This is another one of those where it depends on who is being surprised.

A person coming from csh would not be surprised by null-elision and in
fact would be surprised by the opposite.

> On the other hand, making it on by default would be backwards
> incompatible, and making it off by default would mean there's yet
> another syntax-changing option for everyone to keep in mind

If we ignore the global option and focus on expansion flags, this
becomes much less problematic; we could add a flag with this semantic
... but if you're going to need a flag, you might as well need double
quotes as well.




Messages sorted by: Reverse Date, Date, Thread, Author