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 1:56 PM Sebastian Gniazdowski
<sgniazdowski@xxxxxxxxx> wrote:
> I would say: the code that is needy of using &&/|| in such a way can
> skip this hypothetical new warning option. Covering 8 out of 10
> functions with it is still a good result (this reminds me the previous
> discussion we've had).

I'm not opposed to warnings that may have false positives. That's why
they are warnings rather than errors.

My point here is different. Imagine the documentation for the new
warning:

  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.

Roman.



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