Rainer Deyke wrote:
Walter Bright wrote:
Rainer Deyke wrote:
Syntactic ambiguity. Confusion between an instance of a class and a
reference to that instance.
I was initially thrown by this when I started some Java programming. But
it soon became clear this was an advantage, and I came to prefer it.
I like it in Python, where all variables are references. Java is
similar to Python in this regard, although the existence of primitive
value types complicates the situation somewhat.
I don't like it in D, where reference types and value types coexist. I
especially don't like it in templates in D, where it may not be clear if
you're dealing with a reference type or a value type until instantiation.
Is C++ really better in that regard? Given a non-trivial struct or class
declaration, I'd be hard pressed to determine if it was meant to be a
value or reference type.