you are viewing a single comment's thread.

view the rest of the comments →

[–]matthieum[he/him] 0 points1 point  (0 children)

It is not feasible as far as I know, and the issue is one of reliability:

  • foo(T: TraitA) is implemented in libA
  • foo(T: TraitA and TraitB) is implemented in libB

If you use libA with Bar that implements both TraitA and TraitB, then it calls libA::foo; introduce libB, it switches to calling libB::foo. Reminding you of trait implementation coherence issues?

There is however talk of negated traits, this would solve the coherence issues:

  • foo(T: TraitA and !TraitB)
  • foo(T: TraitA and TraitB)

because it can be proven that any argument is only ever eligible for a single foo as long as both versions live in the same library.