valhalla-dev Digest, Vol 7, Issue 66

Peter Levart peter.levart at gmail.com
Tue Jan 20 10:11:56 UTC 2015


On 01/20/2015 12:33 AM, Brian Goetz wrote:
>> Multi-dimensional matching is not well-served by any loose or ambiguous
>> matching, which is why I had specified a system not needing such.
>
> Except that's exactly how method overload selection works in Java 
> today [1]; by contrast, there are no left-to-right precedence 
> mechanisms.  So while you might consider the left-to-right rule 
> "better", when taken in the context of how the language already works 
> (and how developers think), I think this has to be rejected.
>
>
>
> [1] The lack of a meet rule actually causes problems here as well, 
> such as overloads like foo(Object, String) vs foo(String, Object) 
> (which do you call with foo("", "")?)

Could the meet rule be added to overloads in Java? I mean only in the 
form of a compile-time warning of course. It seems it could be useful 
for API designers.

Peter



More information about the valhalla-dev mailing list