5 ms·
Some languages (eg. Swift, Rust, Kotlin; Dart is working on it) allow you to implement "extension methods" separately from the actual type definitions, even whe
by Hemospectrum 7y ago
Some languages (eg. Swift, Rust, Kotlin; Dart is working on it) allow you to implement "extension methods" separately from the actual type definitions, even when the type in question is from another module/library. It's as if they're codifying the view that "OOP" is all a matter of syntactic convenience, and can't help us with the really hard problems.
- DonaldPShimoda 7y agoProtocols (the Swift name) are an attempt to give greater support to an OOP language in solving the Expression Problem [0] more generally. OOP does great for certain classes of problems all by itself, but it is not enough for everything. Similarly, FP is great for certain classes of problems, but is not enough for everything. I think protocols are neat, but I'm uncertain whether their usefulness outweighs the added mental burden of keeping track of them all (since they can be defined anywhere and take effect everywhere). [0] https://homepages.inf.ed.ac.uk/wadler/papers/expression/expression.txt https://homepages.inf.ed.ac.uk/wadler/papers/expression/expr...