Welcome! Please see the About page for a little more info on how this works.

+2 votes
in Compiler by

Where possible, it would be nice to use arity to guide the method overload disambiguation, to reduce the need for hinting. For example:

(map ^[int] Integer/toString [0 1 2 3])

Here the compiler requires the hint due to the lack of type inference. However:

(^[] String/toLowerCase "Foo")

It seems like this case should be able to be disambiguated without the hint, based on the arity.

1 Answer

+1 vote

This is by design - in qualified constructor, instance method, and static method symbols in invocation or value position require you to specify exactly one method arity/overload via if param-tags. No inference is done, no reflection occurs, and you wll get a compiler exception if the method is ambiguous.

The one special case is static methods in invocation position, as this was the only pre-existing place where qualified methods were allowed, and inference was previously used. For backwards compatibility, inference will still be used in this case (if no param-tags are provided).