3 ms·
> use a proper interval type for the two intervals and a proper return type rather than int You can do that with a "bad" type system like C's, but types themse
by flukus 7y ago
> use a proper interval type for the two intervals and a proper return type rather than int
You can do that with a "bad" type system like C's, but types themselves are a leaky abstraction with many usage decisions needing to be aware of underlying details of the type. Should the variable be stack allocated? Depends on the size of the underlying type and whether it's static. Can I add a variable to this type? Depends on it's usage, it might break binary compatibility.
In the case of type systems the abstraction comes with more than enough benefits to make it worthwhile, but it still leaks.
- lmm 7y agoThat's not a leak, or if it is then the whole concept is meaningless. The abstraction of a decent type system is sound and true: any expression of given type really does have that type. Of course there are lower level details (that's the nature of abstraction), but any properties at the level of the abstraction will hold for any conforming low-level implementation.