3 ms·
There's a difference between "errors should alter the flow of control" and "error types should be transitively declared". The latter failed in Java because the
by erik_seaberg 8y ago
There's a difference between "errors should alter the flow of control" and "error types should be transitively declared". The latter failed in Java because the language didn't have enough support for handling the layering violation. E.g., if the X ctor throws suddenly you can't implement Supplier<X> without dirty hacks like writing an explicit handler that does nothing but rethrow an unchecked type.
- jayd16 8y agoThrowing in constructors is an anti-pattern imo but assuming you need it, how does go solve this? Would you not return nil and an error that you would immediately check? Seems like defensively checking return values in go isn't that much better than catching every exception. Maybe I don't understand the correct go implementation.