The proposal for adding constructors to static extensions is currently (I believe) in a somewhat inconsistent state with respect to declaring constructors in extensions for which the on-declaration is a prefixed name. The text possibly implies that it may be possible to declare such a constructor using a prefixed name, however, I believe that the syntax does not yet support such a declaration, and also the text around invocations I believe would need some modification to account for this. Consider the following examples:
import "foo.dart" as f; // foo.dart declares a class named C and a class named f
import "foo.dart" show D; // foo.dart also declares a class named C
extension E1 on f.C {
f.C.name(); // Is this a valid declaration of a constructor named `C.name`?
}
extension E2 on f.C {
C.name(); // Is this a valid declaration of a constructor named `C.name`?
}
extension E2 on f.f {
f.f(); // Is this a valid declaration of a constructor named `f.f`? Or of a constructor named `f.new`?
}
extension E4 on D {
f.D.name(); // Is this a valid declaration of a constructor named `D.name`?
}
What do we intend to support here?
cc @dart-lang/language-team
The proposal for adding constructors to static extensions is currently (I believe) in a somewhat inconsistent state with respect to declaring constructors in extensions for which the
on-declarationis a prefixed name. The text possibly implies that it may be possible to declare such a constructor using a prefixed name, however, I believe that the syntax does not yet support such a declaration, and also the text around invocations I believe would need some modification to account for this. Consider the following examples:What do we intend to support here?
cc @dart-lang/language-team