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

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



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}

I'm in two minds about this.

On the one hand, null elision breaks the principle of least surprise —
both in reference to other programming languages, and in reference to
SH_WORD_SPLIT's default behaviour being the unlike-Bourne-shell
behaviour.

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 when they
review random autoloaded functions' code.

All in all, perhaps this is a change to keep in mind for 6.0 (deferring
it to a major version due to the incompatibility).

Thoughts?

Cheers,

Daniel




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