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

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

Issue 2852533003: Change specification of main. (Closed)
Patch Set: Fix typo and phrasing. Created 3 years, 7 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 7141 matching lines...) Expand 10 before | Expand all | Expand 10 after
7152 \LMHash{} 7152 \LMHash{}
7153 Compiling a part directive of the form \code{\PART{} $s$;} causes the Dart syste m to attempt to compile the contents of the URI that is the value of $s$. The to p-level declarations at that URI are then compiled by the Dart compiler in the s cope of the current library. It is a compile-time error if the contents of the U RI are not a valid part declaration. It is a static warning if the referenced pa rt declaration $p$ names a library other than the current library as the library to which $p$ belongs. 7153 Compiling a part directive of the form \code{\PART{} $s$;} causes the Dart syste m to attempt to compile the contents of the URI that is the value of $s$. The to p-level declarations at that URI are then compiled by the Dart compiler in the s cope of the current library. It is a compile-time error if the contents of the U RI are not a valid part declaration. It is a static warning if the referenced pa rt declaration $p$ names a library other than the current library as the library to which $p$ belongs.
7154 7154
7155 \LMHash{} 7155 \LMHash{}
7156 It's a compile-time error if the same library contains two part directives with the same URI. 7156 It's a compile-time error if the same library contains two part directives with the same URI.
7157 7157
7158 \subsection{Scripts} 7158 \subsection{Scripts}
7159 \LMLabel{scripts} 7159 \LMLabel{scripts}
7160 7160
7161 \LMHash{} 7161 \LMHash{}
7162 A {\em script} is a library whose exported namespace (\ref{exports}) includes a top-level member named \code{main}. It is a static warning if the static type of \code{main} is not assignable to a function type or is a function type with m ore than two required parameters. 7162 A {\em script} is a library whose exported namespace (\ref{exports}) includes
7163 a top-level function declaration named \code{main}
7164 that can be called with zero, one or two positional arguments.
eernst 2017/05/10 09:30:34 So the situation before: A library containing `mai
Lasse Reichstein Nielsen 2017/05/30 05:45:38 As discussed, I disagree that we should impose con
eernst 2017/05/30 09:14:42 Unsurprisingly, I would still prefer to go from "s
7163 7165
7164 A script $S$ may be executed as follows: 7166 A script $S$ is executed as follows:
7165 7167
7166 \LMHash{} 7168 \LMHash{}
7167 First, $S$ is compiled as a library as specified above. Then, the top-level func tion \code{main} that is in the exported namespace of $S$ is invoked. If \code{m ain} has no positional parameters, it is invoked with no arguments. Otherwise if \code{main} has exactly one positional parameter, it is invoked with a single a ctual argument whose runtime type implements \code{List<String>}. Otherwise \co de{main} is invoked with the following two actual arguments: 7169 First, $S$ is compiled as a library as specified above.
7170 Then, the top-level function defined by \code{main}
eernst 2017/05/10 09:30:34 An exported namespace is a mapping that binds name
Lasse Reichstein Nielsen 2017/05/30 05:45:38 Going for "top level function \code{main}".
eernst 2017/05/30 09:14:42 Acknowledged.
7171 in the exported namespace of $S$ is invoked (\ref{functionInvocation})
7172 with up to two arguments, depending on how many it will accept.
eernst 2017/05/10 09:30:34 The 'depending ..' is too imprecise. Just `up to t
Lasse Reichstein Nielsen 2017/05/30 05:45:38 Going for just "as follows:". The "up to two argum
eernst 2017/05/30 09:14:42 Acknowledged.
7173 If \code{main} can be be called with with two positional arguments,
7174 it is invoked with the following two actual arguments:
7168 \begin{enumerate} 7175 \begin{enumerate}
7169 \item An object whose runtime type implements \code{List<String>}. 7176 \item An object whose runtime type implements \code{List<String>}.
7170 \item The initial message of the current isolate $i$ as determined by the invoca tion of \code{Isolate.spawnUri} that spawned $i$. 7177 \item An object specified when the current isolate $i$ was created,
7178 for example through the invocation of \code{Isolate.spawnUri} that spawned $i$,
7179 or \NULL{} if no such object was supplied.
7171 \end{enumerate} 7180 \end{enumerate}
7172 7181 If \code{main} cannot be called with two positional arguments,
7173 \LMHash{} 7182 but it can be called with one positional argument,
7174 It is a run time error if $S$ does not declare or export either: 7183 it is invoked an object whose runtime type implements \code{List<String>}
eernst 2017/05/10 09:30:34 `invoked [with] an object`
Lasse Reichstein Nielsen 2017/05/30 05:45:37 Done.
7175 \begin{itemize} 7184 as the only argument.
7176 \item A top-level function named \code{main}, or 7185 If \code{main} cannot be called with one or two positional arguments,
7177 \item A top-level getter named \code{main} that returns a function. 7186 it is invoked with no arguments.
7178 \end{itemize}
7179 7187
7180 \commentary { 7188 \commentary {
7181 Note that if \code{main} requires more than two arguments, a run time error will occur. 7189 Note that if \code{main} requires more than two positional arguments,
7182 } 7190 the library is not considered a script.
eernst 2017/05/10 09:30:34 If we keep the approach where `main(a,b,c){}` is d
Lasse Reichstein Nielsen 2017/05/30 05:45:37 I don't plan to keep that approach, so retaining t
eernst 2017/05/30 09:14:42 Right, that's the consistent approach.
7183
7184 \rationale{
7185 The names of scripts are optional, in the interests of interactive, informal use . However, any script of long term value should be given a name as a matter of g ood practice.
7186 } 7191 }
7187 7192
7188 \commentary { 7193 \commentary {
7189 A Dart program will typically be executed by executing a script. 7194 A Dart program will typically be executed by executing a script.
7190 } 7195 }
7191 7196
7197 \LMHASH{}
eernst 2017/05/10 09:30:34 `\LMHash{}`.
Lasse Reichstein Nielsen 2017/05/30 05:45:38 Done.
7198 If a non-script library is provided where a script is expected,
7199 it precludes execution.
7200 As such, it should be reported as a compile-time error,
7201 even if that library compiles successfully as a non-script library.
eernst 2017/05/10 09:30:34 If we keep the "`main(a,b,c){}` is detected at com
Lasse Reichstein Nielsen 2017/05/30 05:45:38 As discussed, I disagree on that. It is not a run
eernst 2017/05/30 09:14:42 At this point I'm trying really hard to find a way
7202
7192 \subsection{URIs} 7203 \subsection{URIs}
7193 \LMLabel{uris} 7204 \LMLabel{uris}
7194 7205
7195 \LMHash{} 7206 \LMHash{}
7196 URIs are specified by means of string literals: 7207 URIs are specified by means of string literals:
7197 7208
7198 \begin{grammar} 7209 \begin{grammar}
7199 {\bf uri:} 7210 {\bf uri:}
7200 stringLiteral 7211 stringLiteral
7201 . 7212 .
(...skipping 947 matching lines...) Expand 10 before | Expand all | Expand 10 after
8149 8160
8150 The invariant that each normative paragraph is associated with a line 8161 The invariant that each normative paragraph is associated with a line
8151 containing the text \LMHash{} should be maintained. Extra occurrences 8162 containing the text \LMHash{} should be maintained. Extra occurrences
8152 of \LMHash{} can be added if needed, e.g., in order to make 8163 of \LMHash{} can be added if needed, e.g., in order to make
8153 individual \item{}s in itemized lists addressable. Each \LM.. command 8164 individual \item{}s in itemized lists addressable. Each \LM.. command
8154 must occur on a separate line. \LMHash{} must occur immediately 8165 must occur on a separate line. \LMHash{} must occur immediately
8155 before the associated paragraph, and \LMLabel must occur immediately 8166 before the associated paragraph, and \LMLabel must occur immediately
8156 after the associated \section{}, \subsection{} etc. 8167 after the associated \section{}, \subsection{} etc.
8157 8168
8158 ---------------------------------------------------------------------- 8169 ----------------------------------------------------------------------
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