Closed bvssvni closed 9 years ago
This is a good idea. I will make this change when I have a minute to update Iron at the same time.
I made this change, but it breaks type inference at several usage sites in Iron, so I reverted it.
Notice that Set<Title> + Set<Size>
has to be replaced with SetTitle
and SetSize
with an impl for every Modifier
.
By moving the default trait methods to the blanket impl, I got rid of the Modifier
constraint. This allows default trait impls for SetTitle
and SetSize
, such that no extra impl is required beside Modifier
.
Closing due to inactivity, but @bvssvni I'd be curious to hear your thoughts about this since November, so feel free to make a new issue or comment here and have me re-open.
@reem That's OK.
piston-quack uses a design where Modifier/SetAt
is implemented for a tuple (Data, Object)
with a Pair
trait for associated types. It ended up a bit complex to solve all the edge cases with generics and uses a macro to generate the impls.
This will make it possible to inherit generic constraints for modifiers, such as:
New trait design for
Set
: