3 ms·
While it’s true that a gear without a bike is not very useful, one could also argue that it’s also effectively impossible to misuse from a perspective of cyclis
by catlifeonmars 6y ago
While it’s true that a gear without a bike is not very useful, one could also argue that it’s also effectively impossible to misuse from a perspective of cyclist safety.
Anyway the real power of the type system is that it gives you, the designer, the ability to define what is correct and what is not correct by composition. For example, you might define a type, CompleteBicycle, which is used as an argument to a ride() function. In your definition of complete bicycle, you could require a non-null gear property of type Gear. Sure, Gear exists independently in the type system, but you haven’t defined any uses for it, so it (by definition) can’t be used (or misused).
Edit: Grammar