You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When overloading a method with a curried version, the compiler is unable to distinguish, even thought a curried version requires a trailing underscore.
@odersky said:
That's as speced. To change this, we'd need a proposal for a revised spec, and its diff to the current one. I suspect, however, the new spec would complicate overloading quite a bit, and therefore would most likely be rejected.
Richard Bradley (richard.bradley) said (edited on Mar 27, 2015 12:58:31 PM UTC):
So methods defined in this pattern are never actually invokeable, by design?
That seems odd.
Perhaps the compiler should issue a warning when encountering methods defined in this pattern to warn users that they will not actually be useable.
When overloading a method with a curried version, the compiler is unable to distinguish, even thought a curried version requires a trailing underscore.
def foo(b: Bar) {
// do something
}
def foo(b: Bar) (f: (Bar) => Baz) {
// do something else
}
Calling:
foo(bar)
causes the compiler to issue an ambiguity error. But had I wanted the curried version, I would (in fact, I'm required to) write:
foo(bar) _
The text was updated successfully, but these errors were encountered: