Skip to content
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

Specification: wrong definition of super closurization equality #24661

Closed
sgrekhov opened this issue Oct 21, 2015 · 2 comments
Closed

Specification: wrong definition of super closurization equality #24661

sgrekhov opened this issue Oct 21, 2015 · 2 comments
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-not-planned Closed as we don't intend to take action on the reported issue

Comments

@sgrekhov
Copy link
Contributor

Dart Language Specification (3-rd Edition / June 2015) reads (16.18.10 Super Closurization):
"Except that iff two closurizations were created by code declared in the same class with identical bindings of this then super1#m == super2#m, super1.m == super2.m, super1#m == super2.m and super1.m == super2#m."
First, it is unclear what "...with identical bindings..." means. Specification should be more clear on that.
Second, consider the following program:

class A {
  int m() => 1;
}

class B extends A {
  getClosurization() {
    return super.m;
  }
}

class C extends B {
  void test() {
    print(super.m == super.getClosurization()); // prints true
  }
}

main() {
  C o = new C();
  o.test();
}

The current Dart implementation (Dart VM version: 1.13.0-dev.6.0 (Wed Oct 7 08:09:59 2015) on "linux_x64") prints true. And it is what I expect. But in this example closurizations were not created by code declared in the same class and therefore, according the spec, should not be equal.

Either specification either implementation is wrong. I think spec should be changed.

@floitschG floitschG added the area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). label Oct 21, 2015
@lrhn
Copy link
Member

lrhn commented Oct 26, 2015

The "identical bindings of this" means that the this value in the methods are identical - i.e., it's methods in the same class and on the same instance.

@munificent
Copy link
Member

Generalized tear-offs are being removed (#27518) so I don't think we have to worry about this.

@munificent munificent added the closed-not-planned Closed as we don't intend to take action on the reported issue label Dec 19, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-language Dart language related items (some items might be better tracked at github.com/dart-lang/language). closed-not-planned Closed as we don't intend to take action on the reported issue
Projects
None yet
Development

No branches or pull requests

4 participants