News for hackers. Stuff that matters.
Re:New Features in Java 14 by manthideaal on Wednesday March 04, 2020 @04:58AM (#22482472)
From your blog (5.5 years using scala) it seems that null is a problem in scala:

Scala avoids the biggest pitfall of multiple inheritance elegantly, by only allowing one parent to have a constructor; classes may only be the first parent, and traits can't have constructors that take arguments. Unfortunately this doesn't mean they don't need to be initialized; in particular, vals in a mixed-in trait will be null if you try to access them in an earlier constructor.[2] As with any null, in the worst cases you may not get an error until much later on.

Re:New Features in Java 14 by lmm on Wednesday March 04, 2020 @08:31PM (#22490096)
Null is not the problem there, null is the symptom. You see exactly the same problem if the val is a primitive type (which can't ever be null): if you access an Int from a mixed-in trait in an earlier constructor, that Int will be 0. This is a real issue, and one where I think Java has actually made the better design choice (interfaces may contain method implementations and constants but not fields - of course they had the benefit of Scala's experience when making that decision), but it's not about null.