Walter:

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

But Java is probably currently the most used language, so I guess they have 
created a simpler language, but not too much simple as Pascal was.


> Value types and polymorphic types are different, have different
purposes, different behaviors, etc.

Right.


>Conflating the two into the same construct makes for poor and confusing 
>abstractions.<

In Python there are (more or less) only objects, and they are managed "by name" 
(similar a "by reference") and it works well enough.


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

This is partially true. The presence of just objects doesn't solve all 
problems, so part of the complexity doesn't go away, it goes into the program. 
On the other hand value semantics introduces a large amount of complexity by 
itself (in C++ there is a huge amount of stuff about this semantics, and even 
in D the design is unfinished still after ten years and after all the 
experience with C++).

So in my opinion in the end the net result is that removing structs makes the 
language+programs simpler.


> 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.

Yes, clearly Java has several faults. It's far from perfect. But introducing 
structs inside Java is in my opinion not going to solve those problems much. 
(Anyway, C# is like a Java+Structs and it too works well enough).


> [...] If that were true, why are Java char/int/double types value types,
> not a reference type derived from Object?

For performance reasons, because originally Java didn't have the advanced 
compilation strategies used today. Languages like Clojure that run on the 
JavaVM use more reference types (for integer numbers too). 


After all this discussion I want to remind you that I am here because I like D 
and I like D structs, unions and all that :-) I prefer to use D many times over 
Java. And I agree that structs (or tagged unions) are better in D for the lexer 
if you want the lexer to be quite fast.

Bye,
bearophile

Reply via email to