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

Named constructors have separate namespace #3040

peter-ahe-google opened this issue May 14, 2012 · 5 comments

Named constructors have separate namespace #3040

peter-ahe-google opened this issue May 14, 2012 · 5 comments
area-language Deprecated: New language issues should be filed at type-enhancement


Copy link

Consider this class:

class Foo {;
  static bar() => new;

This allows you to write:

var a =;
var b = new;

This doesn't seem to be in the spirit of what we set out to achieve when it comes to avoiding multiple name spaces.

Copy link

gbracha commented 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.

Copy link

gbracha commented May 29, 2012

Added this to the M1 milestone.

Copy link

gbracha commented 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.

Copy link

DartBot commented Aug 31, 2012

This comment was originally written by @mhausner

What about this case:

class A {
  foo() {...}

class B extends A { {...}

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 ?

Copy link

gbracha commented 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.

@peter-ahe-google peter-ahe-google added Type-Enhancement area-language Deprecated: New language issues should be filed at labels Aug 31, 2012
@peter-ahe-google peter-ahe-google added this to the M1 milestone Aug 31, 2012
copybara-service bot pushed a commit that referenced this issue May 20, 2022
…25 revisions)

2022-05-19 Create scorecards-analysis.yml (#3032)
2022-05-18 Add the file to published package (#3042)
2022-05-17 Reintroduce query param search (#3026)
2022-05-17 Include docs.dart.js in published code (#3040)
2022-05-17 Optimize built js (#3028)
2022-05-17 Use dart run instead of deprecated dart pub run (#3038)
2022-05-17 fix exception for empty dartdoc_options.yaml file (#3034)
2022-05-16 Fix build config (#3035)
2022-05-02 Drop version back to 5.1.0 (#3031)
2022-05-02 Fixed: YouTube directive respects width/height argument (#3030)
2022-04-19 Update pubspec.yaml (#3025)
2022-04-12 Remove dead field commentRefs, which is always empty (#3021)
2022-04-12 make the converted web frontend follow Dart conventions (#3020)
2022-04-11 convert lib/resources/script.js to Dart (#3016)
2022-04-11 49699333+dependabot[bot] Bump actions/cache from 3.0.1 to 3.0.2 (#3019)
2022-04-10 rename the CI script (#3017)
2022-04-08 49699333+dependabot[bot] Bump actions/cache from 2 to 3.0.1 (#3014)
2022-04-08 49699333+dependabot[bot] Bump markdown from 4.0.1 to 5.0.0 (#3015)
2022-04-08 Move many static declarations to top-level; avoid RegExp (#3009)
2022-04-08 49699333+dependabot[bot] Bump actions/checkout from 2 to 3 (#3013)
2022-04-07 Add a web frontend (#3011)
2022-04-07 enable dependabot deps checks (#3012)
2022-04-07 Do not store the AstNode on ModelNode; eagerly grab the source indexes (#3008)
2022-04-07 Create a .pubignore in order to skip testing files from publish check (#3010)
2022-03-29 Bump to version 5.1.0 (#3006)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
Please CC on the revert to ensure that a human
is aware of the problem.

To file a bug in Dart Documentation Generator:
To file a bug in Dart SDK:

To report a problem with the AutoRoller itself, please file a bug:

Documentation for the AutoRoller is here:

Change-Id: I3467a27d6947c43f7f41acbb2959d72863fd8a34
Commit-Queue: Devon Carew <>
Reviewed-by: Devon Carew <>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
area-language Deprecated: New language issues should be filed at type-enhancement
None yet

No branches or pull requests

5 participants