dart-sdk/docs/language
Erik Ernst 6e3a274c5f "Magic" implicit creation.
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>
2018-02-12 09:03:00 +00:00
..
informal "Magic" implicit creation. 2018-02-12 09:03:00 +00:00
.gitignore Ignore LaTeX output files in docs/language. 2017-03-24 15:45:15 +01:00
Dart.g "Magic" implicit creation. 2018-02-12 09:03:00 +00:00
dart.sty Fixed many whitespace issues in dartLangSpec.tex 2017-12-01 09:44:18 +00:00
dartLangSpec.tex Make it clear that you are not allowed to have spaces in operator-names. 2018-01-16 09:34:41 +00:00
Makefile Specify behavior of e?.v++ and e?.v-- 2015-06-11 15:01:06 -07:00