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

Re: Feature request: a new warning option



On Wed, 2019-10-09 at 15:17 +0200, Sebastian Gniazdowski wrote:
> On Wed, 9 Oct 2019 at 14:08, Roman Perepelitsa
> <roman.perepelitsa@xxxxxxxxx> wrote:
> > 
> > 
> >   Warns if `x && y || z` cannot be proven through static analysis to
> >   be equivalent to `if x; then y; else z; fi`.
> > 
> > Doesn't this strike you as odd? If the latter construct has the
> > desired semantics, why not use it in the first place? It'll obviate
> > the need for a new warning and convey the intention to humans reading
> > the code.
>
> 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 &&/||.

Hmm... that's fair enough, but if you're happy to trade off against
readability I think you have to take possible difficulties with the
syntax on the chin...

pws


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