3 ms·
> 1) Abstract data types encourages closed systems. You may view this as a positive: It enables exhaustiveness checks. But I view it as a way to make your progr
by lmm 10y ago
> 1) Abstract data types encourages closed systems. You may view this as a positive: It enables exhaustiveness checks. But I view it as a way to make your program more fragile. Go's type asserts let you convert to interface types, so you can add new interface implementers later and not have to go fix-up old type-assertions.
Is the idea here that all types should be open? Should I be able to e.g. add 1.5 as a possible instance for the Int and String types?
Interfaces should be open, but one also needs the ability to represent closed datatypes.