> Unfortunately, introducing this kind of concept is exactly the kind of > thing java does NOT do, and languages like Scala DO do: it's not a matter > of superiority, it's a matter of tradeoffs: If this Nothing exists, it > cannot actually be a subtype of Object; a List<?> cannot accept an instance > of List<Nothing>, because I can still put nulls in List<?>, and nulls are > not a valid value for Nothing. Hell, generics in general play havoc with > this: Using trickery I can make a List<Nothing> with nulls in it, and then > write return thisHackedList.get(0), which means in practice that Nothing > needs type checking (i.e. that would lead to a ClassCastException or > similar, even if .get(0) returns null). >
Is this just theorizing? I'd love to see that code. > That's the kind of thing where java has decided that the practical upside > of having a 'Nothing' value is not actually that much; it's largely > academic, and it definitely "feels bad" that the language is not complete, > and that this awesome concept is not actually in your language. However, > adding it to the language definitely incurs a cost: The compiler needs to > do all sorts of things to treat Nothing specially, and this is going to > make the spec much more complicated. > Did you actually check that? Until now, I have only seen a Java-specific issue which doesn't even exist in Scala. I'd love to see some of this complexity caused by Nothing. > Scala-like design says you accept the complexity hit, and theorizes that > if you go whole-hog on this you can actually remove a lot of complexity > because the language is much more flexible. So far that seems like it's > been working out reasonably well for scala. The java-like design says that > these mostly academic features just aren't important enough, and in > practice the language will be simpler if you just don't have them. Where > people need them, they'll kludge it. > Did you just make that up? Sounds ugly. Yet, java's popularity and the robustness of java-based apps > like google ads and many a server out there suggest it's fine. > See the other recent debate. > > Right. I'm saying, well, the jury is still out on this. Is it actually > right to burden your language with the Nothing concept? > Sorry to say that, but your comment really reads like hand-waving with little actual facts. -- You received this message because you are subscribed to the Google Groups "Java Posse" group. To view this discussion on the web visit https://groups.google.com/d/msg/javaposse/-/JhqxS4iiHpIJ. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/javaposse?hl=en.
