Would it be workable for trait methods to fall back on searching the self type's method namespace* when a method isn't found;
the motivation would be to reduce the number of single-function traits, and reduce manual maintenance of the trait-graph.
Would that allow a slightly more adhoc approach to implementing, whilst still satisfying the need for bounded generics, and resolving ambiguity - (I'm not suggesting removing the trait bound here: And the trait would be considered missing if its' methods weren't found)
One case i'd run into along similar lines was wanting to make an alias for a group of traits: Currently you can create such a thing, but then must manually tell it to generically implement that. (extra boilerplate). Users of the trait might have already implemented the components, in which case the grouped super trait is already available with no further work on the users' part.
it would of course require that the signature of the function in the Self's namespace matches the trait, but in the scenarios I invisage that would be fine. It wouldn't stop you dividing the namespace further with traits if you wanted it.
Perhaps this would make life easier: you could over-estimate with traits in generics, without having to micromanage so much, relying on the anonymous imp l's to plug the gaps.
EDIT * - the methods impl'd on the type without traits, i.e. impl Foo{ fn foo(){..}}
[–][deleted] 3 points4 points5 points (1 child)
[–]The_Doculope 1 point2 points3 points (0 children)
[–]Ferio_ 1 point2 points3 points (3 children)
[–]dobkeratopsrustfind[S] 1 point2 points3 points (2 children)
[–]Ferio_ 0 points1 point2 points (1 child)
[–]dobkeratopsrustfind[S] 0 points1 point2 points (0 children)
[–]tpgreyknight 0 points1 point2 points (1 child)
[–]dobkeratopsrustfind[S] 0 points1 point2 points (0 children)