0.9.12-M2
Pre-release
Pre-release
distage:
Added new ModuleDef syntax bind
for binding a single implementation to multiple interfaces:
new ModuleDef {
bind[ImplXYZ]
.to[X]
.to[Y]("special")
.to[Z]
make[User]
}
where User:
// User doesn't have to know that both X and Y
// are the same instance of ImplXYZ, it only knows
// of separate interfaces
class User(
x: X,
y: Y @Id("special"),
) {
...
}
Desugaring:
bind[ImplXYZ]
.to[X]
.to[Y]("special")
.to[Z]
<=>
make[ImplXYZ]
make[X].using[ImplXYZ]
make[Y].named("special").using[ImplXYZ]
make[Z].using[ImplXYZ]
- Binding implementation to multiple interfaces (#652)