Hacker News new | past | comments | ask | show | jobs | submit login

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?



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


Being valuable isn't binary, but you shouldn't stop in the middle if it's possible to do better easily.


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?


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.


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


Wow great news! That makes Flutter even more exciting.


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


Type system helps those who help themselves.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: