-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Optional new
and const
for Dart 2 (meta issue)
#30921
Comments
@munificent I don't think there's any work for the formatter, but it would be good to double check that. |
About the need to adjust the formatter, and possibly other tools: The grammar had to be extended with support for a new construct, namely
and that construct is then used in a couple of places. The point is that we can now have things like |
Yep, but the formatter uses the analyzer parser, so I think it's probably fine. |
Turns out there is one case the formatter needs to handle: SomeGenericClass<int>.someNameConstructor(); I added support for that in dart-lang/dart_style@b89b572. |
Actually, since this is the meta issue that has the spec as the long pole, moving to the Dart2 Stable milestone. |
The formal spec bug is the only remaining issue, so closing this out. |
Should this also work for factory constructors? I'm getting
when calling
|
It should work for all constructors. How are you running the code? |
@lrhn I have Dart v2 installed at I could be that |
@stevenroose perhaps dart-lang/pub#1807 |
Re-opening to track Angular implementation + communication and validation. |
Good news. AngularDart has verified, mostly thanks to @MichaelRFairhurst, that optional new/const works at the latest dev SDKs, including in metadata annotations. Here is a sample PR where we removed it from all example applications: angulardart/angular#1408. |
great news indeed!
Atenciosamente,
Jonathan Rezende
… Em 14 de jun de 2018, à(s) 23:59, Matan Lurey ***@***.***> escreveu:
Good news. AngularDart has verified, mostly thanks to @MichaelRFairhurst <https://github.com/MichaelRFairhurst>, that optional new/const works at the latest dev SDKs, including in metadata annotations. Here is a sample PR where we removed it from all example applications: angulardart/angular#1408 <angulardart/angular#1408>.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub <#30921 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AF6Y3j2vYdc7pCbOXK-c1eKgRx-9YJKEks5t8yMegaJpZM4PnE6T>.
|
@kwalrath is the docs part of this complete? |
It depends on what you mean by "complete". The language tour has a note that
For the rest of the docs and examples, we're planning to wait until Tracking issue: dart-lang/site-www#870 |
Nothing left here is blocking for Dart 2 here, I think. As soon as @munificent should we consider adding this to the dartfmt presubmit for the SDK now to start migrating and shaking out bugs? We probably really don't want to do that for tests though, so we'd need some way to exclude them. So maybe better to just start manually converting SDK code? |
Yeah, I think running |
Does the Dart VM read SDK code when you run with Does dart2js read SDK code when you compile with If so, dropping |
dart2js does - we use the CFE even in Dart1 mode, and the CFE will parse with the missing new/consts always (it is not hidden under a flag). |
@lrhn what remains before we can close this as completed? |
SDK and specification still missing. I guess communication is part of communicating Dart 2.0. |
Should "Remove new and optional const from SDK code" still be part of this task? This meta issue was a planned feature for Dart 2.0, which has completed. AFAIK, no one intends to do this task any time soon. Especially with all of the work being done on the SDK libraries; this would cause a lot of churn if it landed any time in the next few months. Close this meta issue? |
@srawlins I would say keep it here as a means of tracking it. That doesn't mean it has to be prioritized higher than the current work on the SDK libraries. |
Dart 2 will make
new
andconst
operators optional in some cases. The feature is described in https://github.com/dart-lang/sdk/blob/master/docs/language/informal/implicit-creation.md.This feature needs support from, at least, the common front-end. The kernel compiler can, and likely will, generate the same kernel code whether an optional
new
orconst
is present or not, so back-ends should be unaffected. Effectively, the kernel (or even the parser) can perform automatic "new/const" insertion on the program, as soon as it can recognize an invocation as referring to a constructor rather than a static method.The feature extends the grammar with syntax that wasn't previously valid, so the formatter likely needs to be prepared for it.
The analyzer may need to be prepared for the different syntax as well.
We will not back-port this feature to non-kernel based backends.
new
andconst
. #30922)new
andconst
. dart_style#652)new
andconst
. #30923)new
andconst
in Dart 2 language specification. #30924) - this is dartLangSpec.tex, the feature specification has already been landed.The text was updated successfully, but these errors were encountered: