language
language copied to clipboard
Specify null safety: Sections 'Variables' and 'Local Variable Declarations'
Leaf and Lasse, I believe you might discuss this PR and decide on whether one of you would give it a review. For now I'm just putting it on github such that reviewing can start whenever it fits (I guess it makes sense to wait for #2023).
This PR updates the sections 'Variables' and 'Local Variable Declarations' of the language specification to fit the language with null safety.
It is part of a larger PR, but provided in smaller pieces in order to make the reviewing task manageable. Because of this, the updated text contains a handful of undefined \ref{...}
references. They refer to newly added sections which are included in https://github.com/dart-lang/language/pull/2023.
Apart from that, this PR changes dart.sty
to a new version of the file which will work with all the null safety updates (so we don't have to update dart.sty
again and again during this process). However, this causes a couple of changes outside the above mentioned sections: A couple of commands need to get an extra argument (it's an {r}
, specifying the metasymbol which stands for either the empty string or required
, which is now needed in some rules about functions and function types). Similarly, this PR also changes \Gamma
to \Delta
to denote type variable environments, because that's a more commonly used notation (and the new dart.sty
has it in some commands already).
Visit the preview URL for this PR (updated for commit 3285049):
https://dart-specification--pr2052-specify-null-safety-3qf0tqse.web.app
(expires Wed, 26 Jul 2023 11:48:21 GMT)
🔥 via Firebase Hosting GitHub Action 🌎
Sign: 6941ecd630c4f067ff3d02708a45ae0f0a42b88a
@lrhn, would you be able to take a look at this PR? I'm removing @leafpetersen as a reviewer, because it's obviously a good idea to broaden this effort a bit.
@lrhn, when you're back from vacation, could you take a look at this one?
@lrhn, friendly ping.
The approach to type inference is tricky, and we are not going to resolve all issues with that topic in this PR. So I mainly changed the wording at the locations where "type inference is assumed to have taken place already" is obviously wrong. We should deal with that topic by actually specifying type inference in detail, but that won't be right now.
Next, lots of imprecise details have been fixed.
PTAL.
Ah, two more updates needed; will be finished this with this hour.
OK, latest updates have now been uploaded, PTAL.
See also https://github.com/dart-lang/sdk/issues/52704.
@lrhn, friendly ping..
@lrhn, friendly ping...
One more thing: As I mentioned, we currently use 'statically allocated variable' rather than the old 'static variable' meaning 'library variable or \STATIC{} variable' (that was 100% likely to confuse anyone who doesn't know). We need a better phrase, but it's very easy to change all occurrences because 'statically allocated variable' isn't used otherwise.
Changed the text to avoid using the word 'mutable' and the word 'immutable' anywhere. It is now spelled out in each case which modifiers are required/assumed.
Changed the text to avoid using 'statically allocated variable' anywhere. Now spells out every time that the variable is a library variable or a static variable (and that's the new meaning of 'static variable', namely: A variable whose declaration includes the word static
). In several locations we now use 'non-local variable' where we previously had all kinds of non-local variables anyway (as in 'if $v$ is a library variable, a static variable (new meaning), or an instance variable' becomes 'if $v$ is a non-local variable').
Eliminated the phrase 'static function' (there was exactly one, in non-normative text). Now using 'static member', which is well defined (meaning a member declaration that includes the keyword static
).