Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: docs/language/dartLangSpec.tex

Issue 2704573004: Adjusted spec to outlaw built-in identifiers in type annotations. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 \documentclass{article} 1 \documentclass{article}
2 \usepackage{epsfig} 2 \usepackage{epsfig}
3 \usepackage{color} 3 \usepackage{color}
4 \usepackage{dart} 4 \usepackage{dart}
5 \usepackage{bnf} 5 \usepackage{bnf}
6 \usepackage{hyperref} 6 \usepackage{hyperref}
7 \usepackage{lmodern} 7 \usepackage{lmodern}
8 \usepackage[T1]{fontenc} 8 \usepackage[T1]{fontenc}
9 \newcommand{\code}[1]{{\sf #1}} 9 \newcommand{\code}[1]{{\sf #1}}
10 \title{Dart Programming Language Specification \\ 10 \title{Dart Programming Language Specification \\
(...skipping 5384 matching lines...) Expand 10 before | Expand all | Expand 10 after
5395 . 5395 .
5396 5396
5397 5397
5398 5398
5399 {\bf qualified:} 5399 {\bf qualified:}
5400 identifier (`{\escapegrammar .}' identifier)? 5400 identifier (`{\escapegrammar .}' identifier)?
5401 . 5401 .
5402 \end{grammar} 5402 \end{grammar}
5403 5403
5404 \LMHash{} 5404 \LMHash{}
5405 A built-in identifier is one of the identifiers produced by the production {\em BUILT\_IN\_IDENTIFIER}. It is a compile-time error if a built-in identifier is u sed as the declared name of a prefix, class, type parameter or type alias. It is a compile-time error to use a built-in identifier other than \DYNAMIC{} as a ty pe annotation or type parameter. 5405 A built-in identifier is one of the identifiers produced by the production {\em BUILT\_IN\_IDENTIFIER}.
5406 It is a compile-time error if a built-in identifier is used as the declared name of a prefix, class, type parameter or type alias.
5407 It is a compile-time error to use a built-in identifier other than \DYNAMIC{} in a type annotation or type parameter.
Lasse Reichstein Nielsen 2017/02/19 11:43:53 The "in" is somewhat vague, but I think it works.
eernst 2017/02/20 08:25:12 Acknowledged!
5406 5408
5407 \rationale{ 5409 \rationale{
5408 Built-in identifiers are identifiers that are used as keywords in Dart, but are not reserved words in Javascript. To minimize incompatibilities when porting Jav ascript code to Dart, we do not make these into reserved words. A built-in ident ifier may not be used to name a class or type. In other words, they are treated as reserved words when used as types. This eliminates many confusing situations without causing compatibility problems. After all, a Javascript program has no type declarations or annotations so no clash can occur. Furthermore, types shou ld begin with an uppercase letter (see the appendix) and so no clash should occu r in any Dart user program anyway. 5410 Built-in identifiers are identifiers that are used as keywords in Dart, but are not reserved words in Javascript. To minimize incompatibilities when porting Jav ascript code to Dart, we do not make these into reserved words. A built-in ident ifier may not be used to name a class or type. In other words, they are treated as reserved words when used as types. This eliminates many confusing situations without causing compatibility problems. After all, a Javascript program has no type declarations or annotations so no clash can occur. Furthermore, types shou ld begin with an uppercase letter (see the appendix) and so no clash should occu r in any Dart user program anyway.
5409 } 5411 }
5410 5412
5411 \LMHash{} 5413 \LMHash{}
5412 It is a compile-time error if any of the identifiers \ASYNC, \AWAIT{} or \YIELD{ } is used as an identifier in a function body marked with either \ASYNC{}, \ASYN C* or \SYNC*. 5414 It is a compile-time error if any of the identifiers \ASYNC, \AWAIT{} or \YIELD{ } is used as an identifier in a function body marked with either \ASYNC{}, \ASYN C* or \SYNC*.
5413 5415
5414 \rationale{ 5416 \rationale{
5415 For compatibility reasons, new constructs cannot rely upon new reserved words o r even built-in identifiers. However, the constructs above are only usable in co ntexts that require special markers introduced concurrently with these construct s, so no old code could use them. Hence the restriction, which treats these name s as reserved words in a limited context. 5417 For compatibility reasons, new constructs cannot rely upon new reserved words o r even built-in identifiers. However, the constructs above are only usable in co ntexts that require special markers introduced concurrently with these construct s, so no old code could use them. Hence the restriction, which treats these name s as reserved words in a limited context.
(...skipping 2697 matching lines...) Expand 10 before | Expand all | Expand 10 after
8113 8115
8114 The invariant that each normative paragraph is associated with a line 8116 The invariant that each normative paragraph is associated with a line
8115 containing the text \LMHash{} should be maintained. Extra occurrences 8117 containing the text \LMHash{} should be maintained. Extra occurrences
8116 of \LMHash{} can be added if needed, e.g., in order to make 8118 of \LMHash{} can be added if needed, e.g., in order to make
8117 individual \item{}s in itemized lists addressable. Each \LM.. command 8119 individual \item{}s in itemized lists addressable. Each \LM.. command
8118 must occur on a separate line. \LMHash{} must occur immediately 8120 must occur on a separate line. \LMHash{} must occur immediately
8119 before the associated paragraph, and \LMLabel must occur immediately 8121 before the associated paragraph, and \LMLabel must occur immediately
8120 after the associated \section{}, \subsection{} etc. 8122 after the associated \section{}, \subsection{} etc.
8121 8123
8122 ---------------------------------------------------------------------- 8124 ----------------------------------------------------------------------
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698