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

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



Bart Schaefer wrote on Fri, 23 Apr 2021 23:34 +00:00:
> On Fri, Apr 23, 2021 at 3:47 PM Oliver Kiddle <opk@xxxxxxx> wrote:
> >
> > I can just about see the case for warning on typeset -i/-F inf or nan
> > but not on use.
> 
> Warning on -i/-F but not on simple scalar nor on array/hash is not
> very useful because math context doesn't limit expansions to just
> numerics.

Disagree.  The fact that «zsh -fc 'inf=42; : $((inf))'» has a shadowing
issue doesn't make warning on «zsh -fc 'typeset -F inf=42; : $((inf))'»
"not useful".  The latter code doesn't do what its author likely
expected it to, so warning about it would be useful.

In general, a patch needn't fix every variant of a problem in order to
be committable.

Bart Schaefer wrote on Thu, 22 Apr 2021 21:25 +00:00:
> The former warns spuriously if the user has no intention of ever
> mentioning the variable in math context (or of ever using math at all).

What's a use-case for declaring an *integer or float* variable that
doesn't get ever get mentioned in math context?

Cheers,

Daniel




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