Transitive dependencies
If class A depends on B, which depends on and I have a C, can I instantiate an A without also wiring up a B? In other words, would it be possible for this:
val c: C = ...
val a = wire[A]
to generate this?
val c: C = ...
val _macwire_b = new B(c)
val a = new A(b)
Similarly, if I don't have a C in scope but C has a no-args constructor, can macwire instantiate that as well? That is, this:
val a = wire[A]
would become:
val a = new A(new B(new C))
I asked a similar question on the scala gitter channel today about how implicits handle this: https://gitter.im/scala/scala?at=5a280d2e3ae2aa6b3f93a3ab
That's not currently supported, but could be a very useful feature! Maybe it could be called e.g. wireDeep[]?
As for achieving the same of implicits, I don't think it's possible to achieve that result without additional code.
One problem here would be loss of control over instance scope. That is, each time there's a deeply-wired dependency on B, a new instance of B would be created, instead of re-using an existing one. That might not be an issue, but good to keep in mind.
I think that's a fair condition. Java DI frameworks like Guice work the same way, and JSR-330 provides the javax.inject.Singleton annotation to denote classes that should be instantiated only once by libraries or frameworks.