6 ms·
Well, he said "strong" :) Probably meaning a ML-derived type system, not C's or Java's.
by pka 10y ago
Well, he said "strong" :) Probably meaning a ML-derived type system, not C's or Java's.
- catnaroek 10y agoWhy should anyone's first statically typed language be a weakly typed one in 2016?
- coldtea 10y agoBecause C and Java are still going strong and will continue to do so...
- klibertp 10y agoProbably because even in 2016 most programmers never heard of the other possible choices? I started with C instead of SML, which was available then, I think, because everyone I knew coded in C and they all said it's ok and a good language to learn. The same is probably true today: you first need to know that a language exists before trying to learn it, and beginner programmers are going to only know about languages their peers (other beginners, probably) use.
- steveklabnik 10y agoAs if "strong" and "weak" weren't overridden enough when it comes to type systems, many people will use "stronger" and "weaker" when talking about the relative amount of guarantees a static type system can give you. "C has a fairly weak static type system, and Haskell has a very strong static type system." Since the "strong" vs "weak" axis of type systems is already not extremely useful, as very few languages are truly weakly typed, it's usually fine.
- phamilton 10y agoSigh. You're right. There's also a matter of how you use the language. One can make C a lot stronger by using structs as ADTs. Just have the struct include only one field (example, a minutes struct that's only one int). That gives you a lot of compile time guarantees (you can't add minutes and seconds without using a function designed to do so).
- catnaroek 10y agoOkay, then let me define a new axis: useful vs. useless type systems. A type system is useful to the extent types rule out implementation errors and/or miscommunication between the implementer and the user of an abstraction: (0) Algebraic data types, pattern matching and exhaustiveness checking rule out forgetting to handle all the qualitatively different possible outcomes of an operation. (1) Statically typed effects rule out sneaking effects into computations without making them knowable to the user. (2) Substructural type systems rule out resource leaks and uses after free. (3) Rust's borrow checker rules out concurrent modifications of the same object in memory. How usefully typed are C and Java?