Subject: Re: [BUG] emulate sh: arith assignment assigns variable type
From: Peter Stephenson <[email-masked]>
To: [email-masked]
Date: Sat, 2 Jan 2016 21:12:18 +0000
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Sat, 2 Jan 2016 12:46:59 -0800
Bart Schaefer <[email-masked]> wrote:
> On the other hand, is this --
> 
> }  	pm = createparam(t, ss ? PM_ARRAY :
> } +			 isset(POSIXIDENTIFIERS) ? PM_SCALAR :
> }  			 (val.type & MN_INTEGER) ? PM_INTEGER : PM_FFLOAT);
> 
> -- really the correct fix?  I was thinking more along the lines of
> creating it as an integer but then changing the type back to scalar
> at the time of assignment if the assigned string did not parse as an
> arithmetic expression.

That's obviously not what other POSIX shells do, so I don't see how that
can be right.  It's forcing arithmetic evaaluation in cases those shells
wouldn't.  The POSIX* options aren't supposed to be for anything more
than strict(ish) compatibility.

pws