A new error will occur with code like this: trait Foo(x: Int) trait Bar extends Foo // not allowed to extend Foo(0)! class Baz() extends Bar We are told that we need to explicitly specify the inheritance of Foo with its parameter, like so: class Baz() extends Bar, Foo(0)
-
Show this thread
-
You also get to use commas to separate the list of inherited traits.
3 replies 0 retweets 2 likesShow this thread -
Replying to @propensive
And something changed around self types. If X refers to Y members you can say: trait X { this: Y => … } but if X implements any of Y you must say: trait X extends Y { … }.
1 reply 0 retweets 1 like -
Replying to @a4dev
That's very interesting, and I never saw the relation ro self-types before, but it seems like "parameterless trait inheritance" is very much like a self-type, except that if the trait is parameterless anyway, it's inherited... Thanks for the hint!
2 replies 0 retweets 0 likes -
Replying to @propensive
Actually I am wrong. Something has changed in self types but that is not quite it. I will get back to you on that!
1 reply 0 retweets 1 like -
Replying to @a4dev
I hope the old "lambda-style" syntax goes away eventually, at least.
1 reply 0 retweets 0 likes -
Replying to @propensive
I see that is being discussed. I am kind of used to it. And bring back 'implicit' as a keyword I say!
No. No, let's not go there.1 reply 0 retweets 0 likes -
Replying to @a4dev
My feelings about given, using and implicit were never strong... I don't particularly like that "given" is primarily a verb, but is used in its less common nounal or adjectival sense... but I can live with it.
1 reply 0 retweets 1 like -
Replying to @propensive
OK got it. This compiles with scala2 and not with scala3: trait Y { type F <: Fops trait Fops } trait X { this: Y => class F extends Fops } object O extends Y with X
1 reply 0 retweets 0 likes -
Replying to @a4dev @propensive
For motivation, consider Y to be an API and X one of its implementations. For scala3 we need to say trait X extends Y { ... }
1 reply 0 retweets 0 likes
Ah, that makes some sense. I remember reading about changes to shadowing of inner classes/types somewhere...
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.