T
thibault.langlois
Hello,
I see from several sources(*) the following as part of the definition
of the Java syntax:
numeric_expression
::=
( ( "-" | "++" | "--" ) expression )
| ( expression ( "++" | "--" ) )
| <more here>
This means that I could write something like (a + b)++ which sounds
strange to me (and to the compiler too
.
I wonder why the syntax was defined this way. Was it in order to
simplify it for didactical purpose ?
Is it impossible to define the java syntax such that (a + b)++ is not
allowed ?
One solution could be to define two kinds of expressions, for the
right-side and for the left-side of the attribuition.
Thibault Langlois
(*)
http://cui.unige.ch/db-research/Enseignement/analyseinfo/JAVA/numeric_expression.html
http://duke.csc.villanova.edu/jss1/
I see from several sources(*) the following as part of the definition
of the Java syntax:
numeric_expression
::=
( ( "-" | "++" | "--" ) expression )
| ( expression ( "++" | "--" ) )
| <more here>
This means that I could write something like (a + b)++ which sounds
strange to me (and to the compiler too
I wonder why the syntax was defined this way. Was it in order to
simplify it for didactical purpose ?
Is it impossible to define the java syntax such that (a + b)++ is not
allowed ?
One solution could be to define two kinds of expressions, for the
right-side and for the left-side of the attribuition.
Thibault Langlois
(*)
http://cui.unige.ch/db-research/Enseignement/analyseinfo/JAVA/numeric_expression.html
http://duke.csc.villanova.edu/jss1/