Hi! Recently I ran into a bit of behaviour which I find rather odd, because it feels like it could be a source of very hard to track bugs. However, I’m not sure whether this is intentional, or a bug, hence I want to ask here first, before submitting a bug report. Compare these three assignments:
val b = true
&& false
val p = 3
+ 4
val t = 3
* 4
The interesting thing is, that the value of variable b
will be false
(the whole expression is parsed correctly), value of p
will be 3
(because + 4
is parsed as application of unary +
, instead of infix binary +
). Finally, t
won’t even compile, because there is no unary *
and apparently, *
doesn’t get the same treatment as &&
does.
Is this intentional? Isn’t there a way to make this more uniform? In Java, everything works as expected due to semicolons.