Looking for champion - std.lang.d.lex

Walter Bright newshound2 at digitalmars.com
Tue Oct 26 21:39:32 PDT 2010


bearophile wrote:
> Walter:
> 
>> Java made a related mistake by failing to acknowledge that value types have
>> any useful purpose at all (unless they are built-in).
> 
> Java was designed to be simple! Simple means to have a more uniform
> semantics.

So was Pascal. See the thread about how useless it was as a result.

A hatchet is a very simple tool, easy to understand, and I could build a house 
with nothing but a hatchet. But it would make the house several times as 
expensive to build, and it would look like it was built with a hatchet.


> Removing value types was a good idea if you want to simplify a
> language (and remove a mountain of details from C++). And from the huge
> success of Java, I think the designers were right (later C# has added values
> too, but C# is indeed a more complex than Java). The Java VM also is now
> often able to allocate not escaping objects on the stack (escape analysis)
> regaining some of the lost performance.

The issue isn't just about lost performance. It's about proper encapsulation of 
a type. Value types and polymorphic types are different, have different 
purposes, different behaviors, etc. Conflating the two into the same construct 
makes for poor and confusing abstractions.

It shifts the problem out of the language and onto the programmer. It does NOT 
make the complexity go away.


> What I miss more in Java is not single structs (single values),

There's a lot more to miss than that. I find Java code tends to be excessively 
complex, and that's because it lacks expressive power. It was summed up for me 
by a colleague who said that one needs an IDE to program in Java because with 
one button it will auto-generate 100 lines of boilerplate.



More information about the Digitalmars-d mailing list