I remember in Julia they called this multiple dispatch
Equal specificity, neither wins -> compile error?
(As a non-expert) I like @myrrlyn's take of possibly allowing negative bounds for things.
impl<T: Copy> Something for Vec<T>
impl<T: Ord + !Copy> Something for Vec<T>
#2 takes precedence. Though I'm sure there will be gotchas.
-
-
This is pretty much what happens with C++20 Concepts. If one constraint "subsumes" another then it's preferred, otherwise there's an ambiguity and you get a compiler error. And you can do negative bounds to break ambiguities.
-
Concrete examples: https://godbolt.org/z/h7Vl6A
End of conversation
New conversation -
-
-
given that I know the type system is implemented as a logic program, this is giving me weird feelings
-
although the !T trait bound notation is already a thing so it's not that weird
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.