[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2020-03-27 Thread Thorsten Glaser
** Changed in: mksh Status: Fix Committed => Fix Released -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail https://bugs.launchpad.net/bugs/1857702 Title: " +=" operator

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-30 Thread Thorsten Glaser
This totally makes sense in mksh only. $ i=4+4; echo $i This is an assignment of the string "4+4" to the variable i. The string is then, between assignment and storage, parsed as an arithmetic expression, because i is of integer type. The expression is calculated and the result stored. $ i=i+1;

Re: [Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-30 Thread Martijn Dekker
Op 29-12-19 om 23:55 schreef Thorsten Glaser: As discussed heavily on IRC, other shells can use ((…)) or let to work like mksh, and the mksh behaviour is semantically correct. Your position makes no sense, because in mksh (and ksh93, bash, zsh) you can do things like: $ typeset -i i $

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-30 Thread jvdh
maybe you can convince the `shellcheck' guys to support mksh ;). but I was rather thinking of "error" as in "syntax error", i.e. disallow += on integers all together as being then easy to spot and repair. I am somewhat paranoid about shells silently behaving differently, that's all ... :). for

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-30 Thread Thorsten Glaser
Warning reporting during running of a script is supremely hard, you cannot use any file descriptors; basically, you have to reserve one with a high number for syslog and do it that way and hope someone reads syslog… so I never did. We really need a linting shell runner or something ☹ -- You

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-30 Thread jvdh
thanks for making this discrepant behaviour of mksh more explicit in the manpage/FAQ. I believe this is helpful (as, generally, a "(in)compatibility table" comparing all relevant shells would be...). regarding opening bugs all over the place in (at least) 3 other shells for this issue: funny ;).

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-29 Thread Thorsten Glaser
As discussed heavily on IRC, other shells can use ((…)) or let to work like mksh, and the mksh behaviour is semantically correct. I’ve documented this in more detail in the manual page and the mksh FAQ now but kept the behaviour as to not break older scripts written in mksh. You might wish to

Re: [Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-27 Thread jvdh
On 27.12.19 23:02, Thorsten Glaser wrote: > and it’s most definitely not emulation of ksh93 > > some ksh88 and little parts of ksh93, but e.g. no float and other crap I've never used ksh88. so I do not know the intersection with ksh93. but my experience so far is that it seems easier to port a

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-27 Thread Thorsten Glaser
and it’s most definitely not emulation of ksh93 some ksh88 and little parts of ksh93, but e.g. no float and other crap or complicated things -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions:

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-27 Thread Thorsten Glaser
01 in an integer variable is still 1 on output (010 may be 10 or 8 depending on the posix flag) more later -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail

Re: [Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-27 Thread jvdh
On 27.12.19 17:02, Thorsten Glaser wrote: > Erm… that’s right, += is string concatenation. ok, I got it that this seems to be the idea here, but 1. what about typeset -i x=0; x+=1; echo $x # → 1 (as in ksh/bash/zsh) if += categorically does string concat no matter what, should this not

[Bug 1857702] Re: " +=" operator does string concatenation for integer variables

2019-12-27 Thread Thorsten Glaser
Erm… that’s right, += is string concatenation. Write “let” before the line to make it integer addition. -- You received this bug notification because you are a member of mksh Mailing List, which is subscribed to mksh. Matching subscriptions: mkshlist-to-mksh-bugmail