4 ms·
It's significantly different than subclassing. The wikipedia examples are instructive: a dependent type is a type whose definition depends on a value. A "
by joeblubaugh 9y ago
It's significantly different than subclassing. The wikipedia examples are instructive:
a dependent type is a type whose definition depends on a
value. A "pair of integers" is a type. A "pair of integers
where the second is greater than the first" is a dependent
type because of the dependence on the value.
- Animats 9y agoThat's a subclass with an object invariant. (Gotta use the new buzzwords to be l33t. Even for old ideas.)
- joeblubaugh 9y agoSure, so if you use Ada you can write types like this and the runtime will enforce your invariants automatically. What other non-academic languages support that? It’s something I miss from Ada for sure.