2 ms·
A few comments: 1. This debate is not (or no longer) binary. There is a whole spectrum of static typing richness, from dynamic typing to well beyond Idris. The
by pron 11y ago
A few comments:
1. This debate is not (or no longer) binary. There is a whole spectrum of static typing richness, from dynamic typing to well beyond Idris. The debate, then, is not whether we should be at any of the extreme, but where along the spectrum (including, maybe, the extremes). The interesting question to pose to proponents of very rich type systems, then, is "should we always use the richest type system possible?", and if not, why not? The whole debate -- which, again, is not binary -- hides in two of the questions the author lists in the end: "How easy can it be made to program in a language... ?" Nobody argues that the richer the type system the more properties can be proven (except for one major caveat I mention in item 3). The debate isn't about what character strings containing programs can be rejected or accepted. Programming language design is 5% theory and 100% psychology. What string the compiler accepts is a question for PL theorists. What language is "better" is a question that is 100% psychological, and has absolutely nothing to do with one theory or another. It's a question PL researchers are simply not qualified to answer (Also, even before psychology, it may well be that moving from one point along the spectrum towards richer typing has a cost -- simple, economic cost in development time or in performance -- that is higher than the benefit of extra correctness. Most programs need to be correct only up to a point. Why should they pay for a type system that will make them more correct than they need to be?)
2. The question, "How close can we bring those test suites to the unattainable ideal of never accepting a broken program?" directed at dynamic typing can also be directed at static typing. True, a statically typed language may reject all programs, but practical ones will accept broken ones as well as reject correct ones, simply because there are properties the type system won't verify.
3. Testing isn't the only way to verify dynamically typed programs -- or any program along the typing-spectrum -- for properties that aren't enforced by its type system. There are quite good formal verification methods that don't rely on types. True, the author uses a confusing, self-referential (undecidable? :)) definition for types: "a type is a label used by a type system to prove some property of the program's behavior" that is hard to argue with ("a type is something the type system uses"), but there are "property annotations" in the form of pre- and post-conditions used by verifiers, that aren't normally regarded as types (they don't form a particularly nice algebra), and may be used at any point along the spectrum to prove properties beyond the reach of the particular type system. The implication that types are the only way to prove correctness is wrong.