Re: Assigning void
So questioning a design decision and trying to understand its rational[e]
is trolling? Really?
Yup, because there's no way anyone on this list could possibly answer
that question. You might try asking some of the language conferences or
at JavaOne. They might be able to tell you, or at least give you a
All I can personally say, and I'm pretty sure all anyone here can say,
Nope. I said something different, for example.
is "Java is easy to read" is a goal, and allowing inline conditional is
seen as detrimental to that goal. Maybe.
I'm afraid I disagree with markspace here. First of all, asking unanswerable
questions is not /per se/ trolling. Second, there is much one can say about
the rationale for Java. The Founding Coders have written a lot on the ideas
behind Java, so we aren't reasoning in a vacuum. Furthermore, the rationale
is deduceable from the JLS. Or a rationale is, in any event. It is
straightforward to determine why '?:' cannot be a statement from the cited
JLS references already.
It is clearly part of the rationale of Java that not everything that can be
done should be.
Java prohibits standalone expressions as statements, unlike C.
It's such a fundamental and basic and foundational difference between the
languages that I rarely hear anyone question it. "So Java prohibits
standalone expressions as statements. Big deal."
Fine. Clearly it's part of the rationale of Java that a statement, to be
a statement and not just an expression, must effect something.
What does 'x? 4 : 5' effect?
'?:' is placed in the operators table. Ergo, the rationale not to allow
standalone ternary is the rationale not to allow standalone operators