3 ms·
To be fair, isn't type projection a Scala feature? Have you ever seen another language that can do it?
by yawaramin 11y ago
To be fair, isn't type projection a Scala feature? Have you ever seen another language that can do it?
- lmm 11y agoIt's not a language-level feature. It's a pattern that makes use of several features - type members, structural types, member selection. (You can often write these things more readably by splitting them onto two lines, putting the type alias in one place and the use of it in another, avoiding the need for the structural type and member selection). It's like the visitor pattern in a language that doesn't have pattern matching, or an explicit Y combinator in a language that doesn't have recursion. Some newer languages have this kind of functionality (in Haskell it's a GHC extension, I think).