The common Enrich-My-Library pattern seems to be something like
class Foo(value: Int)
implicit def int2Foo(i: Int) = new Foo(i)
Why isn't it possible to just add the implicit
to the constructor itself like this
class Foo implicit (value: Int)
considering that the constructor isn't much more than a method with some additional restriction?
Surprisingly, the following does work:
class Foo(value: Int) {
implicit def this(a: String) = this(a.toInt)
}