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

Re: sh emulation POSIX non-conformances ("inf"/"Inf" in arithmetic expressions)



On Thu, Apr 22, 2021 at 8:31 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
> On 2021-04-13 08:17:42 +0100, Stephane Chazelas wrote:
> > I think it would be worth documenting that nan and inf are
> > recognised in arithmetic expressions (and warn against using
> > variables with the same name).
>
> IMHO, zsh should also output a warning when such variables are used.

Exactly how would that work?

Warning anytime the names "inf" or "nan" (and case variants) get
values assigned to them seems like overkill.

If they appear as $inf or $nan then there's no conflict.  Still warn?

If "inf" and "nan" appear in math context as the bare strings they're
currently taken as constants.  Always make a (usually
wasted/fruitless) check to see whether there happens to be a variable
of the same name and emit a "watch out, not used" message?




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