class Test
{
Void main()
{
x := 5
echo ("x = $x\n")
++x
echo ("x = $x\n")
}
}
If the first echo statement ends with a semicolon (;), then the code works. If the increment of x is done with x++, and not ++x, then all is fine.
brianSun 18 Jul 2010
That is the correct behavior according to the current grammar.
Things like ++ and -- are not perfectly unambitious with regard to newlines versus semicolons.
We have made some changes to the grammar to require certain things like the ( symbol of a call be on the same line of the call target. We could potentially do the same thing for the ++ and -- operators if everyone agrees with that restriction.
rfeldmanSun 18 Jul 2010
I'd agree with that. I can't think of any scenario I've ever heard of where someone really wanted to be able to put the ++ or -- on a separate line from the variable.
lbertrandSun 18 Jul 2010
+1 To separate the operator from the operand does not make any sense at all.
caseyMon 19 Jul 2010
I am yet another in support of this notion
AkcelistoMon 19 Jul 2010
+1. I support this restriction.
brianMon 19 Jul 2010
Renamed from ++var not working properly to Require ++/-- to be on same line
Coderz Sun 18 Jul 2010
Hi
The following code will fail
If the first echo statement ends with a semicolon (;), then the code works. If the increment of x is done with x++, and not ++x, then all is fine.
brian Sun 18 Jul 2010
That is the correct behavior according to the current grammar.
Things like
++
and--
are not perfectly unambitious with regard to newlines versus semicolons.We have made some changes to the grammar to require certain things like the
(
symbol of a call be on the same line of the call target. We could potentially do the same thing for the++
and--
operators if everyone agrees with that restriction.rfeldman Sun 18 Jul 2010
I'd agree with that. I can't think of any scenario I've ever heard of where someone really wanted to be able to put the ++ or -- on a separate line from the variable.
lbertrand Sun 18 Jul 2010
+1 To separate the operator from the operand does not make any sense at all.
casey Mon 19 Jul 2010
I am yet another in support of this notion
Akcelisto Mon 19 Jul 2010
+1. I support this restriction.
brian Mon 19 Jul 2010
Renamed from ++var not working properly to Require ++/-- to be on same line
brian Mon 19 Jul 2010
Promoted to ticket #1150 and assigned to brian
brian Wed 8 Sep 2010
Ticket resolved in 1.0.55
changeset