mirror of
https://github.com/dart-lang/sdk
synced 2024-09-18 21:51:18 +00:00
6e3a274c5f
Description which is relevant as of January 2018: The more aggressive approach where `const` is inserted whenever possible (for instance creation expressions) and whenever required (for composite literals), and `new` is inserted otherwise, is now the agreed policy. This means that the remaining discussion is on the specification of this policy, not the policy itself. This has been true approximately since Dec 1st, 2017. Here is a brief overview of the feature which is specified in the document added by this CL: The introduction of 'implicit creation' adjusts the grammar such that instance creation expressions (such as `new C()`) can always omit the keyword (`new` or `const`). The semantics is that these expressions will still invoke the same constructor (which may produce a fresh instance in case of a generative constructor, and some object that may or may not be new in case of a factory), as if `new` or `const` had been added implicitly. The choice of whether to add `new` or `const` is made according to the policy described above. ---------------------------------------------------------------------- Original description, FYI: Copy of Rietveld 3012703002: magic optional const Adjusted informal spec optional-new to insert `const` whenever possible The current version of optional-new.md specifies that `const` should be inserted into certain syntactic phrases (when specific identifiers satisfy some constraints), but only when these phrases occur in a const context. This CL changes that approach and specifies that `const` should also be inserted outside const contexts, if the resulting expression is a correct constant expression. We haven't yet decided on whether we want the current (predictable) model or we want the more "magic" one specified in this CL; this CL is intended to be landed if we choose the latter, and discarded if we choose the former. Change-Id: I602e7eaf3d4c7904277af45c6f62089c77bd5117 Reviewed-on: https://dart-review.googlesource.com/3160 Reviewed-by: Leaf Petersen <leafp@google.com> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com> |
||
---|---|---|
.. | ||
informal | ||
.gitignore | ||
Dart.g | ||
dart.sty | ||
dartLangSpec.tex | ||
Makefile |