4 ms·
> vastly superior typing system. (=> less bugs) I have no horse in this race, but claiming it to be "vastly superior" and implying "less bugs" makes it sound l
by throwamon 4y ago
> vastly superior typing system. (=> less bugs)
I have no horse in this race, but claiming it to be "vastly superior" and implying "less bugs" makes it sound like this is a logical consequence, when you're actually staying on one side of an endless debate that to me doesn't have clear winners. For instance, from the little I've learned about Clojure, they claim the lack of a "vastly superior type system" is a feature, not a bug, and it's a result of a fundamental difference in some beliefs about how to write correct software.
From this I wonder how misrepresentative your other comparisons are as well. But don't get me wrong, OCaml is probably my "favorite language I've never actually used" (I've never "actually used" Clojure in "real projects" either).
- toolslive 4y agoTake any open source python project on github (or others) look at the list of issues and count the number of 'NoneType' has no attribute ... instances. All these could have been avoided by a decent type system. I rest my case ;)
- tgflynn 4y agoI don't think I've ever seen anyone seriously argue against the claim that strong typing systems at least prevent many types of bugs. Now people may think that they are more productive in a language with weak types but that's a different consideration.
- camgunz 4y agoThis was on HN the other day: https://github.com/hwayne/awesome-cold-showers#static-vs-dynamic-typing-a-literature-review https://github.com/hwayne/awesome-cold-showers#static-vs-dyn.... I would probably add a caveat to the listed caveats that testing might not be considered? Like if every dynamically typed code base implements an ad-hoc typechecker with a testing framework, it's a distinction without a difference.
- laserlight 4y agoI’ve passed wrong type of arguments to Python functions and assumed type of the return value wrong countless of times. That has never happened in Haskell. I don’t know how to reconcile my experience with the statement that there’s no evidence that strong typing reduces bugs.
- camgunz 4y agoI program primarily in (untyped) Python (which, I get is technically strongly typed but people don't think in technical terms) these days, and I almost never experience type errors. I guess I could attribute this to a couple things: - I'm very specific about when I use None - I'm a big fan of named function arguments - I like to think my naming of things is pretty good, as are my conventions for parameters - I try to handle all possible cases (what I mean here is I do and if I don't I made a mistake) I use tests very sparingly in personal projects, but yet I haven't really felt their absence. If I ever write a piece of particularly hairy code (metaprogramming comes to mind... lord) I'll write a quick script testing some cases and then delete it. Anyway, all that is to say I think part of dynamic programming is you build an immune system for this stuff.
- laserlight 4y agoI’ve similarly developed my own habits. But why spend our effort into developing habits, when we can address the problems across people --- junior and senior --- automatically with a type system.
- camgunz 4y agoOh 100% agree. The problem I've run into is my habits aren't others' habits, so we burn time arguing about how best to $CODE, and I rarely walk away from those satisfied or more educated (I'm sure this feeling is mutual haha). I wonder if "immune system" is to "type system" as "my special formatting" is to "use a formatter" here.
- hedora 4y ago
- pharmakom 4y agoI think the big win is actually immutable data and pure functions. It just so happens that strong typing tends to come along with these things (e.g. Haskell, OCaml)