6 ms·
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?
by rimunroe 8y ago
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?
- freddie_mercury 8y ago"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.
- carlmr 8y agoBeing valuable isn't binary, but you shouldn't stop in the middle if it's possible to do better easily.
- kjeetgill 8y agoI 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?
- sorokod 8y agoType system helps those who help themselves.
- stickfigure 8y agoUnequivocally, 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.
- igouy 8y ago> … 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 https://www.dartlang.org/guides/language/sound-dart
- stickfigure 8y agoWow great news! That makes Flutter even more exciting.
- lmm 8y ago> 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.