3 ms·
The problem is the solution is often to make the compiler ignore types all together and use interface {} wholesale, then test interfaces with type assertions.
by aikah 8y ago
The problem is the solution is often to make the compiler ignore types all together and use interface {} wholesale, then test interfaces with type assertions.
If Go had a least unions, it would be a bit less painful to describe a range of finite types while keeping things strictly typed in functions and methods. Unions are a limited form of type polymorphism in a garbage collected language.
- weberc2 8y agoI'd be disappointed if Go went for unions instead of full-on Rust-like enums, but I agree with your general point.