2 ms·
"This is a really useful distinction to draw (in many ways it's more important than when the two types support different methods, because it's easier to get the
by jerf 12y ago
"This is a really useful distinction to draw (in many ways it's more important than when the two types support different methods, because it's easier to get the two confused), and as far as I can see would be completely impossible in Go."
Per jbooth, it literally couldn't be easier (three characters shorter than Haskell even!), and I'm also not sure what this has to do with what I said, since I was talking about accidentally implementing interfaces and you're talking about deriving new types that you then do not add any methods to.
"Implementing the same kind of injection by multiply-inheriting in a traditional OO language isn't as crazy as that article seems to think - in fact, it's exactly how the cake pattern works in Scala."
First, it's my article. Second, based on my admittedly quick reading of http://www.cakesolutions.net/teamblogs/2011/12/19/cake-pattern-in-depth http://www.cakesolutions.net/teamblogs/2011/12/19/cake-patte..., it looks an awful lot like Scala is doing the same thing Go is here, declaring a set of interfaces (called "traits" in this case) that one thing implements, not actually multiply inheriting. "Multiple inheritance" is a particular thing, not a vague word salad phrase.
"Again, I really think this is just culture. If you write Java the way you write Go - ignore the JavaBean conventions, don't abstract things that don't need to be abstracted - you end up with very similar code."
I'm really not convinced. Given the large number of distinct Java cultures that have arisen, surely at least one of them would have valued simple code by now. The fact that none seems to have, and the fact that I can trace the differences between Go and Java that would lead one to conclude that Java is fundamentally a more paperwork-heavy language, it is still very easy for me to believe that Go is a fundamentally simpler language.
And yes, that evidence tends to extend to pretty much every other language too. It would probably be more accurate to say that Java is a fundamentally verbose language, which shouldn't exactly scan as some sort of wild claim, after nearly two decades of massive, massive collective experience with it. Java has been the thing that all the other languages that value conciseness have compared themselves to for a long time for a reason.
- lmm 12y ago> since I was talking about accidentally implementing interfaces and you're talking about deriving new types that you then do not add any methods to. Go makes a distinction between interfaces and types? Why?It's useful to have the type system enforce that you only call methods that exist. And a language in which you can't pass around functions as values is crippled - but if your types can contain functions, surely they should behave as interfaces. > "Multiple inheritance" is a particular thing, not a vague word salad phrase. Look again at the way the actual context is constructed. You compose together a bunch of traits, which can contain implementation as well as interface; this is multiple inheritance in the sense people normally use the phrase. > Given the large number of distinct Java cultures that have arisen, surely at least one of them would have valued simple code by now. I don't think there are distinct cultures. There's a common Java culture, and the corporate influence has been large. And any other languages used in the same kind of setting - C++ and C#, mainly - seem to me to be just as verbose as Java, meaning it's not the language but the organizations using it.