17 ms·
Pretend there was a type "numbers between 1 and 4." Then, when you try to cast a 5 to that type, it would fail. Types are just sets of possible instance values;
by derefr 17y ago
Pretend there was a type "numbers between 1 and 4." Then, when you try to cast a 5 to that type, it would fail. Types are just sets of possible instance values; that most languages limit them to reasoning only about the outermost features of the type (e.g. capacity of 1 vs N, mutability, signedness or realness) makes them orders of magnitude less useful than they could be.
- omouse 17y agoPretend there was a type "numbers between 1 and 4." Pascal and Ada have this I think. I think Eiffel has contracts to enforce that type of thing instead.