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
I agree this is undesirable. Nevertheless, I'm tentatively categorizing it as an enhancement rather than a defect (a defect is an inconsistency/error in the spec). I agree we should try and fix it.
A constructor name always begins with the name of its immediately enclosing class, and may optionally be followed by a dot and an identifier id. It is a compile-time error if id is the name of a member declared in the immediately enclosing class.
I think this resolves the issue in the spirit of a single namespace.
The above text would allow this, but what is the semantics? Would the instance method foo, which is inherited by B, get overridden by the named constructor B.foo ?
In this case, nothing has changed from previous behavior. Constructors never override anything and are not inherited. So A's foo() and the constructor in B do not interact.
Activity
gbracha commentedon May 14, 2012
I agree this is undesirable. Nevertheless, I'm tentatively categorizing it as an enhancement rather than a defect (a defect is an inconsistency/error in the spec). I agree we should try and fix it.
Set owner to @gbracha.
Removed Type-Defect label.
Added Type-Enhancement, Accepted labels.
gbracha commentedon May 29, 2012
Added this to the M1 milestone.
gbracha commentedon Jul 4, 2012
Section 7.6 now reads:
A constructor name always begins with the name of its immediately enclosing class, and may optionally be followed by a dot and an identifier id. It is a compile-time error if id is the name of a member declared in the immediately enclosing class.
I think this resolves the issue in the spirit of a single namespace.
Added Done label.
DartBot commentedon Aug 31, 2012
This comment was originally written by @mhausner
What about this case:
class A {
foo() {...}
}
class B extends A {
B.foo() {...}
}
The above text would allow this, but what is the semantics? Would the instance method foo, which is inherited by B, get overridden by the named constructor B.foo ?
gbracha commentedon Aug 31, 2012
In this case, nothing has changed from previous behavior. Constructors never override anything and are not inherited. So A's foo() and the constructor in B do not interact.
Roll Dart Documentation Generator from 334072b0cad4 to cf0685a2d1ce (…