hg: lambda/lambda/langtools: Next round of implementation reflecting the latest 'State of the Lambda' draft; implemented features are:
Nathan Bryant
nathan.bryant at linkshare.com
Mon Jul 26 10:31:05 PDT 2010
Neal Gafter wrote:
> ... I prefer that we define a subtype relation
> between lambda expressions and object types (SAM types and function
> types) and use that for overload resolution as usual. That is the
> approach that BGGA takes.
Does this mean that the following is always ambiguous?
interface Block<T> {
void do(T t);
}
interface SpecializedBlock<T> extends Block<T> {
}
class Foo {
void forEach(Function<T> f) {
}
void forEach(SpecializedFunction<T> f) {
}
}
new Foo().forEach(#(f) {//something});
According to the usual rules, we resolve the call to
forEach(SpecializedFunction), but in a great many cases this is exactly
the opposite of what the user would intend.
More information about the lambda-dev
mailing list