lambda syntax tutorial
Fredrik Ohrstrom
oehrstroem at gmail.com
Thu Aug 5 03:47:07 PDT 2010
> Uhmm, yes and no.
> On the one hand, as Fredrik has pointed out, adding overloaded versions
> of a method to a class can already result in ambiguity errors (best
> case) or 'stale' resolution (worst case) anywhere else in the codebase.
>
> On the other hand, I admit that this syntax is more prone to this kind
> of problems since the argument list is completely unspecified - but it's
> just matter of quantity, not quality ;-)
Well, you could either say that when searching for the most specified
method target, you take the one with the fewest arguments and supply
null as the arguments for resolution.
Or you could simply forbid compiling when several overloaded targets exist.
> Explicit syntax does not entirely solve the problem, as explicit
> argument types might still undergo an overload resolution process:
Exactly, Joe Darcy's blog entry is a good read:
http://blogs.sun.com/darcy/entry/kinds_of_compatibility
Regarding the question whether adding overloaded methods should be
considered as source compatible, I quote:
"Adding overloaded methods has the potential to change method
resolution and thus change the signatures of the method call sites in
the resulting class file. Whether or not such a change is problematic
with respect to source compatibility depends on what semantics are
required and how the different overloaded methods operate on the same
inputs, which interacts with behavioral equivalence notions."
//Fredrik
More information about the lambda-dev
mailing list