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

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

Issue 136473013: Tweak text to clarify that using atype variable in an expression in a static method is a compile ti… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« 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{dart} 3 \usepackage{dart}
4 \usepackage{bnf} 4 \usepackage{bnf}
5 \usepackage{hyperref} 5 \usepackage{hyperref}
6 \newcommand{\code}[1]{{\sf #1}} 6 \newcommand{\code}[1]{{\sf #1}}
7 \title{Dart Programming Language Specification \\ 7 \title{Dart Programming Language Specification \\
8 {\large Version 1.11}} 8 {\large Version 1.11}}
9 \author{The Dart Team} 9 \author{The Dart Team}
10 \begin{document} 10 \begin{document}
(...skipping 3063 matching lines...) Expand 10 before | Expand all | Expand 10 after
3074 $id(a_1, \ldots, a_n, x_{n+1}: a_{n+1}, \ldots, x_{n+k}: a_{n+k})$, 3074 $id(a_1, \ldots, a_n, x_{n+1}: a_{n+1}, \ldots, x_{n+k}: a_{n+k})$,
3075 3075
3076 where $id$ is an identifier. 3076 where $id$ is an identifier.
3077 3077
3078 If there exists a lexically visible declaration named $id$, let $f_{id}$ be the innermost such declaration. Then: 3078 If there exists a lexically visible declaration named $id$, let $f_{id}$ be the innermost such declaration. Then:
3079 \begin{itemize} 3079 \begin{itemize}
3080 \item 3080 \item
3081 If $f_{id}$ is a local function, a library function, a library or static getter or a variable then $i$ is interpreted as a function expression invocation (\ref {functionExpressionInvocation}). 3081 If $f_{id}$ is a local function, a library function, a library or static getter or a variable then $i$ is interpreted as a function expression invocation (\ref {functionExpressionInvocation}).
3082 \item 3082 \item
3083 Otherwise, if $f_{id}$ is a static method of the enclosing class $C$, $i$ is equ ivalent to $C.id(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k}) $. 3083 Otherwise, if $f_{id}$ is a static method of the enclosing class $C$, $i$ is equ ivalent to $C.id(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k}) $.
3084 \item Otherwise, $f_{id}$ is necessarily an instance method or getter of the enc losing class C, and i is equivalent to the ordinary method invocation $\THIS{}.i d(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k})$. 3084 \item Otherwise, $f_{id}$ is considered equivalent to the ordinary method invoca tion $\THIS{}.id(a_1, \ldots , a_n, x_{n+1}: a_{n+1}, \ldots , x_{n+k}: a_{n+k}) $.
3085 \end{itemize} 3085 \end{itemize}
3086 3086
3087 %Otherwise, if there is an accessible (\ref{privacy}) static method named $id$ d eclared in a superclass $S$ of the immediately enclosing class $C$ then i is equ ivalent to the static method invocation $S.id(a_1, \ldots, a_n, x_{n+1}: a_{n+1} , \ldots, x_{n+k}: a_{n+k})$. 3087 %Otherwise, if there is an accessible (\ref{privacy}) static method named $id$ d eclared in a superclass $S$ of the immediately enclosing class $C$ then i is equ ivalent to the static method invocation $S.id(a_1, \ldots, a_n, x_{n+1}: a_{n+1} , \ldots, x_{n+k}: a_{n+k})$.
3088 3088
3089 %\rationale{ 3089 %\rationale{
3090 %Unqualified access to static methods of superclasses is inconsistent with the i dea that static methods are not inherited. It is not particularly necessary and may be restricted in future versions. 3090 %Unqualified access to static methods of superclasses is inconsistent with the i dea that static methods are not inherited. It is not particularly necessary and may be restricted in future versions.
3091 %} 3091 %}
3092 3092
3093 Otherwise, if $i$ occurs inside a top level or static function (be it function, method, getter, or setter) or variable initializer, evaluation of $i$ causes a \cd{NoSuchMethodError} to be thrown. 3093 Otherwise, if $i$ occurs inside a top level or static function (be it function, method, getter, or setter) or variable initializer, evaluation of $i$ causes a \cd{NoSuchMethodError} to be thrown.
3094 3094
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
3924 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. 3924 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.
3925 } 3925 }
3926 3926
3927 Evaluation of an identifier expression $e$ of the form $id$ proceeds as follows: 3927 Evaluation of an identifier expression $e$ of the form $id$ proceeds as follows:
3928 3928
3929 Let $d$ be the innermost declaration in the enclosing lexical scope whose name i s $id$. If no such declaration exists in the lexical scope, let $d$ be the decl aration of the inherited member named $id$ if it exists. 3929 Let $d$ be the innermost declaration in the enclosing lexical scope whose name i s $id$. If no such declaration exists in the lexical scope, let $d$ be the decl aration of the inherited member named $id$ if it exists.
3930 %If no such member exists, let $d$ be the declaration of the static member name $id$ declared in a superclass of the current class, if it exists. 3930 %If no such member exists, let $d$ be the declaration of the static member name $id$ declared in a superclass of the current class, if it exists.
3931 3931
3932 \begin{itemize} 3932 \begin{itemize}
3933 \item If $d$ is a class or type alias $T$, the value of $e$ is an instance of cl ass \code{Type} reifying $T$. 3933 \item If $d$ is a class or type alias $T$, the value of $e$ is an instance of cl ass \code{Type} reifying $T$.
3934 \item If $d$ is a type parameter $T$, then the value of $e$ is the value of the actual type argument corresponding to $T$ that was passed to the generative con structor that created the current binding of \THIS{}. \commentary{ We are assure d that \THIS{} is well defined, because if we were in a static member the refere nce to $T$ would be a compile-time error (\ref{generics}.)} 3934 \item If $d$ is a type parameter $T$, then the value of $e$ is the value of the actual type argument corresponding to $T$ that was passed to the generative con structor that created the current binding of \THIS{}. If, however, $e$ occurs in side a static member, a compile-time error occurs.
3935
3936 %\commentary{ We are assured that \THIS{} is well defined, because if we were in a static member the reference to $T$ is a compile-time error (\ref{generics}.)}
3935 %\item If $d$ is a library variable then: 3937 %\item If $d$ is a library variable then:
3936 % \begin{itemize} 3938 % \begin{itemize}
3937 % \item If $d$ is of one of the forms \code{\VAR{} $v$ = $e_i$;} , \code{$T$ $v $ = $e_i$;} , \code{\FINAL{} $v$ = $e_i$;} or \code{\FINAL{} $T$ $v$ = $e_i$;} and no value has yet been stored into $v$ then the initializer expression $e_i$ is evaluated. If, during the evaluation of $e_i$, the getter for $v$ is referenc ed, a \code{CyclicInitializationError} is thrown. If the evaluation succeeded yi elding an object $o$, let $r = o$, otherwise let $r = \NULL{}$. In any case, $r$ is stored into $v$. The value of $e$ is $r$. 3939 % \item If $d$ is of one of the forms \code{\VAR{} $v$ = $e_i$;} , \code{$T$ $v $ = $e_i$;} , \code{\FINAL{} $v$ = $e_i$;} or \code{\FINAL{} $T$ $v$ = $e_i$;} and no value has yet been stored into $v$ then the initializer expression $e_i$ is evaluated. If, during the evaluation of $e_i$, the getter for $v$ is referenc ed, a \code{CyclicInitializationError} is thrown. If the evaluation succeeded yi elding an object $o$, let $r = o$, otherwise let $r = \NULL{}$. In any case, $r$ is stored into $v$. The value of $e$ is $r$.
3938 \item If $d$ is a constant variable of one of the forms \code{\CONST{} $v$ = $e$;} or \code{\CONST{} $T$ $v$ = $e$;} then the value $id$ is the value of the compile-time constant $e$. 3940 \item If $d$ is a constant variable of one of the forms \code{\CONST{} $v$ = $e$;} or \code{\CONST{} $T$ $v$ = $e$;} then the value $id$ is the value of the compile-time constant $e$.
3939 % Otherwise 3941 % Otherwise
3940 % \item $e$ evaluates to the current binding of $id$. 3942 % \item $e$ evaluates to the current binding of $id$.
3941 % \end{itemize} 3943 % \end{itemize}
3942 \item If $d$ is a local variable or formal parameter then $e$ evaluates to the c urrent binding of $id$. 3944 \item If $d$ is a local variable or formal parameter then $e$ evaluates to the c urrent binding of $id$.
3943 %\item If $d$ is a library variable, local variable, or formal parameter, then $ e$ evaluates to the current binding of $id$. \commentary{This case also applies if d is a library or local function declaration, as these are equivalent to func tion-valued variable declarations.} 3945 %\item If $d$ is a library variable, local variable, or formal parameter, then $ e$ evaluates to the current binding of $id$. \commentary{This case also applies if d is a library or local function declaration, as these are equivalent to func tion-valued variable declarations.}
3944 \item If $d$ is a static method, top-level function or local function then $e$ e valuates to the function defined by $d$. 3946 \item If $d$ is a static method, top-level function or local function then $e$ e valuates to the function defined by $d$.
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after
5828 \item The names of compile time constant variables never use lower case letters. If they consist of multiple words, those words are separated by underscores. Ex amples: PI, I\_AM\_A\_CONSTANT. 5830 \item The names of compile time constant variables never use lower case letters. If they consist of multiple words, those words are separated by underscores. Ex amples: PI, I\_AM\_A\_CONSTANT.
5829 \item The names of functions (including getters, setters, methods and local or l ibrary functions) and non-constant variables begin with a lowercase letter. If t he name consists of multiple words, each word (except the first) begins with an uppercase letter. No other uppercase letters are used. Examples: camlCase, dar t4TheWorld 5831 \item The names of functions (including getters, setters, methods and local or l ibrary functions) and non-constant variables begin with a lowercase letter. If t he name consists of multiple words, each word (except the first) begins with an uppercase letter. No other uppercase letters are used. Examples: camlCase, dar t4TheWorld
5830 \item The names of types (including classes and type aliases) begin with an uppe r case letter. If the name consists of multiple words, each word begins with an uppercase letter. No other uppercase letters are used. Examples: CamlCase, D art4TheWorld. 5832 \item The names of types (including classes and type aliases) begin with an uppe r case letter. If the name consists of multiple words, each word begins with an uppercase letter. No other uppercase letters are used. Examples: CamlCase, D art4TheWorld.
5831 \item The names of type variables are short (preferably single letter). Examples : T, S, K, V , E. 5833 \item The names of type variables are short (preferably single letter). Examples : T, S, K, V , E.
5832 \item The names of libraries or library prefixes never use upper case letters. I f they consist of multiple words, those words are separated by underscores. Exam ple: my\_favorite\_library. 5834 \item The names of libraries or library prefixes never use upper case letters. I f they consist of multiple words, those words are separated by underscores. Exam ple: my\_favorite\_library.
5833 \end{itemize} 5835 \end{itemize}
5834 } 5836 }
5835 5837
5836 5838
5837 \end{document} 5839 \end{document}
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