3 ms·
> And if a type system can not guard against run-time errors, what’s the merit of having one? The type annotations would document the programmer's assumptions
by layer8 8y ago
> And if a type system can not guard against run-time errors, what’s the merit of having one?
The type annotations would document the programmer's assumptions and lead to fail-fast behavior. In the presented use case, it would be immediately clear from the run-time type error that the input data isn't in the expected format (as opposed to a typing bug somewhere else in the program).
- a-saleh 8y agoSecond, as aid in design. I had the pleasure to use languages capable of deriving implementations from types directly (where otherwise you'd use reflection) and ones with type-directed search and typed-holes (even though unsafeCoerce fitting every hole is a bit annoying :)
- winter_blue 8y agoWhat language was this?