3 ms·
> It’s only useful because of what it accomplishes: moving errors from runtime to compile time. Even that isn’t a goal on its own. The real goal is reducing run
by sublinear 3y ago
> It’s only useful because of what it accomplishes: moving errors from runtime to compile time. Even that isn’t a goal on its own. The real goal is reducing runtime errors. Type safety is one of the best methods of achieving these cascading goals, but it’s far from the only one.
Why is an example necessary for this? It's trivially correct.
- Dylan16807 3y ago> It's trivially correct. That's the problem. You can't develop a meaningful sense of balance if you only say trivially correct things. And the specific need for an example is situations where you could use type safety but don't want to.
- slowmovintarget 3y agoIt doesn't take into account the whole range of errors that can creep into runtime. If a type system only moves 2% of programming errors to compile time, but costs you in terms of coupling, complexity, and effort, it may not be worthwhile. This is especially true if you can catch that same two percent of errors with tests instead, and avoid the coupling and effort penalties. Personal opinion: Type systems are more useful for initial code comprehension and tooling than for writing it in the first place, or preventing bugs.