News for hackers. Stuff that matters.
Re:Go's power is in emergent behavior by azth on Saturday April 26, 2014 @11:19PM (#7653772)
Java's `final` while useful for primitives, it is not really that useful for reference types, which constitute the majority of types. C++'s `const` is a much better solution. Better yet, both Rust and D have superior immutability constructs.
Re:Go's power is in emergent behavior by danieldk on Sunday April 27, 2014 @02:49AM (#7654210)
Java's `final` while useful for primitives, it is not really that useful for reference types, which constitute the majority of types.

They are if you use them in conjunction with immutable classes, such as Guava's immutable collections.

Unfortunately, immutability is only a promise and not typed. But in practice, having a member that is final and of an immutable class works well.

Re:Go's power is in emergent behavior by azth on Sunday April 27, 2014 @03:07AM (#7654235)
Yep. The same applies with Scala too (with `val` vs `var` declarations). I still don't like the separation of type declarations with the actual implementation; they should be the same, which is what Rust and even C++ got right.
Re:Go's power is in emergent behavior by danieldk on Sunday April 27, 2014 @03:52AM (#7654327)
Well, with C++'s 'mutable' it's also not much more than a promise ;).
Re:Go's power is in emergent behavior by pron on Sunday April 27, 2014 @06:37AM (#7654607)
Immutability can be typed with Java 8's pluggable type systems . There's an implementation of immutable types in the Checker framework.
Re:Go's power is in emergent behavior by lmm on Sunday April 27, 2014 @05:47PM (#7657068)
Sure, but at that point you're not really writing Java any more. If you decide to use Checkers many of Java's plus points (in particular the huge library ecosystem and all the development tools) no longer apply.
Re:Go's power is in emergent behavior by pron on Sunday April 27, 2014 @08:18PM (#7657569)
The entire JDK is annotated with Checkers types.
Re:Go's power is in emergent behavior by lmm on Monday April 28, 2014 @12:32PM (#7661027)
Sure, but what proportion of the packages in maven central are?
Re:Go's power is in emergent behavior by pron on Sunday April 27, 2014 @06:20AM (#7654572)
Well, all reference types are eventually made of primitives -- and arrays. The problem with Java's final is that there are no final arrays. This is planned to be resolved in Java 9.