5 ms·
> Those type annotations are the tests, Disagree slightly. Type annotations are logical propositions and the compiler proves them for you. That is to say: Tes
by lomnakkus 10y ago
> Those type annotations are the tests,
Disagree slightly. Type annotations are logical propositions and the compiler proves them for you.
That is to say: Tests can only prove the presence of bugs, not absence. Types prove the absence of (type-related) bugs. They essentially give you theoretically perfect test coverage (modulo bugs in the compiler).
- mcphage 10y ago> They essentially give you theoretically perfect test coverage (modulo bugs in the compiler). Theoretically perfect test coverage, for a particular class of bugs. But that class of bugs isn't the most prevalent class, nor are they the hardest class to fix. So it still is a question of, is that the best place to put development time? And beyond that—are all type annotations equally relevant, or are there some that are very valuable, and some that are less so, and so an optionally typed language would be ideal in that regard?
- lomnakkus 10y ago> Theoretically perfect test coverage, for a particular class of bugs. But that class of bugs isn't the most prevalent class [snip] Well, except maybe is is? They're certainly extremely severe when they occur. (Especially if your language is weakly typed like C/C++.) Without the proper research, who knows? (I'm only talking about my own experience, so YMMV. I'm not even sure a proper metric for a 'fair' comparison can be constructed, even in theory, so again YMMV.) EDIT: Just curious as a point of interest: What statically typed languages do you have non-trivial experience in? This is not a gotcha, or a haha-look-a-the-noob type question. I find that the quality of the $ST_LANG has a huuuuuuuge impact on how people perceive the value of $ST_IN_GENERAL... if that makes sense.
- mcphage 10y ago> Well, except maybe is is? They're certainly extremely severe when they occur. [...] Without the proper research, who knows? Maybe is is? In general that hasn't been my experience (they happen, but not that often, and are usually easy to figure out). I agree that research is needed to decide, but the research I've seen references doesn't seem to hold that up. But it's not something I've looked closely into; too much discussion about it ends up getting into holy war arguments, and I stay away. > I'm only talking about my own experience, so YMMV. Me as well :-) > What statically typed languages do you have non-trivial experience in? Java (which has a garbage type system) and Objective-C. I'm in the process of learning Swift and Scala, but I don't have much experience in either yet. More languages back when I was in college, but that was a while ago, and you don't really get non-trivial experience in college. > I find that the quality of the $ST_LANG has a huuuuuuuge impact on how people perceive the value of $ST_IN_GENERAL... I agree 100%. And it's not that I think ST is worthless—although Java's type system really tries its damnedest to make it worthless—but spending most of my time in Ruby, one of the wildest-west languages out there, I still don't find type errors cropping up very often, or being a major issue when they do. On occasion, sure, one can be hard to find. But they're really not a major source of error in my day-to-day life; and if ever a language were susceptible to them, it's Ruby. Still, if the language used matters that much, then it's not just ST that's the solution, it's ST with a certain level of sophistication.