3 ms·
It's also really good for testing: if you want to mock some opaque third-party object, you can just create an interface with the same methods as that object and
by logicchains 9y ago
It's also really good for testing: if you want to mock some opaque third-party object, you can just create an interface with the same methods as that object and use it in your code. Nominal types often don't allow this, such as how in Java you can't make a class to which you don't have the source implement your own interface, or make it painful, like orphan instance restrictions in Rust and Haskell.