Are there cases where it's preferable to mixin traits to access the functionality of "static" methods, rather than importing objects with those methods?
Say we want to access the functionality of a method a(). Would we ever extend a trait that contains a() rather than import an object that contains a()?
If we look at the following example:
1)
trait A {
def a() {}
}
...
class B extends A {
val b = a()
}
vs.
2)
object A {
def a() {}
}
...
import A._
class B {
val b = a()
}
Is there any reason to prefer the first approach, even if there is no "is-a" relationship between the two classes B and A?