I came across an interesting post on twitter by scalaLang. Where this code compiles and works
class A(implicit implicit val b: Int)
val objA = new A()(42)
Can someone please explain me how is it working? I read the documentation of implicits but didn't found a case like this. Please explain me what's happening here.
Any help is appreciated !
You can have implicit
before the last parameter list of a class or a method, and also before any member of a class or a trait. This simply combines both, which is probably legal just because forbidding it would make the language specification and the parser slightly more complex for no real benefit. I don't think there is any reason to ever use this or any difference from writing implicit
once.