Possible Duplicate:
scala and traits on object instances
Is it possible to mix in a trait to an already existing object ?
Something like:
val s = new MyClass
val sWithTrait = s with myTrait
The code above does not work, but maybe the syntax is wrong or it is not possible at all ?
Dynamic mixins are not possible in regular Scala, but I seem to remember that there was an attempt at a compiler plugin called Autoproxy that allowed something along these lines. Not sure about the state of it though.