Closed lrhn closed 5 years ago
I think some further explanation is needed. That said:
Constructors are not members.
Section 10.6 states:
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.
Section 6.1 says:
It is a compile-time error if there is more than one entity with the same name declared in the same scope.
So duplicates of Foo.id are illegal. Foo.Foo is also legal, though perhaps it should not be.
Set owner to @gbracha. Added Accepted label.
No milestone now: This will not block Dart 2.
The clarification will still need to be performed, hence the issue remains open.
Closing: I believe this has been resolved, particularly in the section 'Class Member Conflicts' in dartLangSpect.tex.
The specification (section "Constructors") says that it's a compile time error to have a constructor Foo.id if "id" is declared as a member in the class. I think the specification needs to be e
Is a constructor a declared member of the class? It seems it isn't, since other parts of the specification says "members or constructors".
If it is a member, what is its name? Is it "Foo.id" or "id"? What is the name of the default constructor: "Foo" or ""?
What prevents having two constructors named "Foo.id"? If constructors are not members, or the name of "Foo.id" isn't "id", the text above does not prevent it.
Also, if the name of the constructor "Foo" is "", then there is nothing preventing the constructor name "Foo.Foo"? Is this correct? It seems the VM disallows "Foo.Foo", but dart2js and the analyzer allows it.