-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Type system should treat function valued getters as methods? #2849
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This comment was originally written by @seaneagan Starred! It should also work in reverse, C1 should be a legitimate implementation of: interface I { G get f();} Note as well that getting the Function value works the same with either implementation: new C1().f; I think the way to spec. it is to have methods desugar into Function valued getters, which yields closurization semantics for free, and avoids needing to specify Function getters separately from other getters, which would be strange. Also see doc linked in issue #1616 (should be merged with this issue or vice versa) for more comments. |
Added this to the M1 milestone. |
Removed this from the M1 milestone. |
Added this to the M1 milestone. |
Removed this from the M1 milestone. |
Added this to the Later milestone. |
Removed this from the Later milestone. |
Removed Oldschool-Milestone-Later label. |
With the type system of Dart 2, we are going in the opposite direction from this. |
Given
interface I { int f();}
class C1 implements I {
int f() => 1;
}
typedef int G();
is
class C2 implements I {
G get f() {return () => 2;}
}
a legitimate implementation of I? Currently, this is disallowed. Yet some have requested such functionality. After all,
new C2().f();
works just as well as
new C1().f();
The text was updated successfully, but these errors were encountered: