As for the return type:
def wrap(src: Int): (Dependency[Int], Dependency[Int]#Box) = {
val dep = new Dependency[Int]
val box = dep.box(src)
(dep, box)
}
As for getting the values from the tuple:
def unwrap() = {
val x = wrap(20)
val (dep, _) = x
val (_, box: dep.Box) = x
val v = dep.unbox(box)
v
}
So this workaround pulls out the first value, and uses the type thereof in a type ascription to get the second value.