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

Re: [BUG] emulate sh: arith assignment assigns variable type



On Sat, 2 Jan 2016 12:46:59 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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



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