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

Re: Feature request: a new warning option

On Wed, Oct 9, 2019 at 3:17 PM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> The x && y || z is less verbose. It doesn't require `then' and `else'
> and `fi'. I'm writing from my point of view – that are the reasons why
> I use &&/||.

Supposing that "if-then-else is too verbose" is a problem that
warrants extending zsh, a natural solution would be to provide an
alternative syntax for the same construct. Something analogous to
`x ? y : z` from C and other languages derived from it.

Note that C had an extra reason besides terseness to introduce this
syntax: if-then-else is a statement while the ternary is an
expression. This reason doesn't apply to zsh, which leaves saving
on typing as the only benefit of the contemplated innovation.
Since `x ? y : z` already has a meaning in zsh, the new syntax would
have to be different and likely unfamiliar to users.

All-in-all, doesn't seem worth the trouble. if-then-else has the
desired semantics, isn't more verbose than in other languages,
and is easy to read even for people unfamiliar with zsh.


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