News for hackers. Stuff that matters.
Re:The Java type system is broken by rimunroe on Thursday July 19, 2018 @09:47AM (#17566187)
Is a type system really worth that much if it can't help you in a situation where your code is ugly and hard to follow?
Re:The Java type system is broken by freddie_mercury on Thursday July 19, 2018 @09:57AM (#17566279)
"Is X really worth it if it isn't perfect and doesn't cover every edge case?"

I kinda feel like humanity has repeatedly decided the answer to this question is "yes".

"Being valuable" isn't binary. There are relative amounts of value, I think.

Re:The Java type system is broken by carlmr on Thursday July 19, 2018 @10:36AM (#17566662)
Being valuable isn't binary, but you shouldn't stop in the middle if it's possible to do better easily.
Re:The Java type system is broken by kjeetgill on Thursday July 19, 2018 @11:41AM (#17567340)
I think that's always the conflict in these discussions. We can usually agree on how things work but your "broken and unsounds" is simply a "limitation" to others.

Saying things like "do better easily" makes sense in the context of fixing something that's broken.

But for anyone who just sees it just as a limitation this comes off as presumptuous. What do you want to change? How do you want to overcome the limitation? At what cost?

Re:The Java type system is broken by stickfigure on Thursday July 19, 2018 @10:03AM (#17566351)
Unequivocally, yes.

Several new languages (eg Typescript, Dart) have optional type systems that still bring significant value to the table.

Sure - all other things being equal, I'd much rather have a type system that is completely sound. Ceylon's type system is beautiful and I'm happy to see its union + intersection types being adopted by Typescript. But honestly, I'm not going to lose much sleep over these particular issues in Java. Bad code gets refactored.

A bigger complaint should be made that generic type erasure makes libraries hard (eg, the number of places you have to pass around Class<?> or TypeReference objects to let the runtime know what to do). But that was a clearly a compromise decision and everyone knows about it.

Re:The Java type system is broken by igouy on Thursday July 19, 2018 @11:20AM (#17567140)
> … Dart… have optional type systems…

fyi "Dart’s type system is now sound" and "…types are mandatory".

https://www.dartlang.org/guides/language/sound-dart

Re:The Java type system is broken by stickfigure on Thursday July 19, 2018 @12:24PM (#17567820)
Wow great news! That makes Flutter even more exciting.
Re:The Java type system is broken by lmm on Thursday July 19, 2018 @04:01PM (#17569750)
> Several new languages (eg Typescript, Dart) have optional type systems that still bring significant value to the table.

I think it's too early to say that this approach has proven to be successful - indeed another reply says that Dart has switched to a stronger type system with required types, which I'd take as significant evidence that optional typing is not a good tradeoff. Certainly my experience of the checkers framework in Java was that optional types are the worst of both worlds.

> But honestly, I'm not going to lose much sleep over these particular issues in Java. Bad code gets refactored.

I'm worried (or rather, I would be worried if I hadn't seen the bug reports, which seem to be being taken seriously and fixed in the compiler). If they can happen in bad code, who's to say they can't happen in good code.

> A bigger complaint should be made that generic type erasure makes libraries hard (eg, the number of places you have to pass around Class<?> or TypeReference objects to let the runtime know what to do). But that was a clearly a compromise decision and everyone knows about it.

I'd argue that the only cases where you need that are when you're doing something you shouldn't (reflection). But I guess in a language without typeclasses there are problems that have no good solution.

Re:The Java type system is broken by sorokod on Thursday July 19, 2018 @10:00AM (#17566327)
Type system helps those who help themselves.