3 ms·
Don't try to port a pattern-matching approach, use the native stuff you've actually got. What you just said has got this old Smalltalker starting to think of p
by stcredzero 11y ago
Don't try to port a pattern-matching approach, use the native stuff you've actually got.
What you just said has got this old Smalltalker starting to think of pattern matching as "polymorphism on steroids." Is that what it actually is?
- jerf 11y agoIt bears certain similarities to multiple dispatch, as if a case statement was an inlined multiple-dispatch function, but I'd say that much as objects can theoretically be implemented with closures and closures can theoretically be implemented with objects but I don't think they're best thought of as the "same thing", polymorphism and various dispatch techniques aren't really the same thing as pattern matching. My real point here is use what you've got; trying to use object polymorphism in Haskell would be as big a mistake there as trying to naively jam pattern matching into Go. Stick to the native idioms as much as possible. While I agree that Go's native idioms are limiting compared to some other languages I also think a lot of people grossly overestimate the limitations.
- stcredzero 11y agoEverything in Smalltalk was pretty much polymorphism, lambdas, and reflection. I suspect that's why I like golang. (There are a few other tricks, but better not to go there unless you really know what you're doing.)
- coldtea 11y ago>Everything in Smalltalk was pretty much polymorphism, lambdas, and reflection. I suspect that's why I like golang. Huh? While it has both, Go is as far from lambdas and reflection as you can go and still be modern language.