-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Allow method overloading on bound generic types #3622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think this is by design, since it sounds like allowing this would sacrifice coherence. |
I don't think it necessarily violates coherence, but it would violate "no overloading" rules I proposed here: http://smallcultfollowing.com/babysteps/blog/2012/10/04/refining-traits-slash-impls/ I also describe a workaround. |
Admittedly, a very painful one. |
The thing is that what @erickt is really asking for here is not exactly overloading. Instead, the use of overloaded bounds was kind of a workaround for the inability to say something like "a type T that is serializable by any serializer". Actually, the best answer (at least at the moment) for this specific scenario is to use a trait type. I don't believe the Serializable interface refers to the
Here I've rephrased the example in terms of In any case, I'm going to close, because I don't expect we'll fix this case. |
Implement LLVM x86 SSE4.2 intrinsics SSE4.2 is arguably the least important SIMD extension for the x86 ISA, but it should still be supported for the sake of completeness.
It'd be nice if we could support method overloading on generic types, but overloading only works on concrete types. I ran into this when I was implementing the new serialization library. Here's a reduced example: https://gist.github.com/3801125. Without generic method overloading, I cannot generically use two different serializers in the same function.
The text was updated successfully, but these errors were encountered: