|
|
|
|
|
by barnacs
117 days ago
|
|
Every time you introduce a type for a "value invariant" you lose compatibility and force others to make cumbersome type conversions. To me, invalid values are best expressed with optional error returns along with the value that are part of the function signature. Types are best used to only encode information about the hierarchy of structures composed of primitive types. They help define and navigate the representation of composite things as opposed to just having dynamic nested maps of arbitrary strings. |
|
What would you say to someone who thinks that nested maps of arbitrary strings have maximum compatibility, and using types forces others to make cumbersome type conversions?