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

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

Issue 93153002: Change specification of @proxy to be compatible with implemementation. (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.0}} 8 {\large Version 1.01}}
9 \author{The Dart Team} 9 \author{The Dart Team}
10 \begin{document} 10 \begin{document}
11 \maketitle 11 \maketitle
12 12
13 \tableofcontents 13 \tableofcontents
14 14
15 15
16 \newpage 16 \newpage
17 17
18 \pagestyle{myheadings} 18 \pagestyle{myheadings}
(...skipping 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 \item It is a static warning a concrete class has an abstract member (declared o r inherited). 1556 \item It is a static warning a concrete class has an abstract member (declared o r inherited).
1557 \item It is a static warning and a dynamic error to call a non-factory construct or of an abstract class (\ref{new}). 1557 \item It is a static warning and a dynamic error to call a non-factory construct or of an abstract class (\ref{new}).
1558 \item If a class defines an instance member named $m$, and any of its superinter faces have a member named $m$, the interface of the class overrides $m$. 1558 \item If a class defines an instance member named $m$, and any of its superinter faces have a member named $m$, the interface of the class overrides $m$.
1559 \item An interface inherits all members of its superinterfaces that are not ov erridden and not members of multiple superinterfaces. 1559 \item An interface inherits all members of its superinterfaces that are not ov erridden and not members of multiple superinterfaces.
1560 \item If multiple superinterfaces of an interface define a member with the same name $m$, then at most one member is inherited. That member (if it exists) is t he one whose type is a subtype of all the others. If there is no such member, th en: 1560 \item If multiple superinterfaces of an interface define a member with the same name $m$, then at most one member is inherited. That member (if it exists) is t he one whose type is a subtype of all the others. If there is no such member, th en:
1561 \begin{itemize} 1561 \begin{itemize}
1562 \item A static warning is given. 1562 \item A static warning is given.
1563 \item If possible the interface gets a member named $m$ that has the minimum number of required parameters among all the members in the superinterfaces, the maximal number of positionals, and the superset of named parameters. The typ es of these are all \DYNAMIC{}. If this is impossible then no member $m$ appears in the interface. 1563 \item If possible the interface gets a member named $m$ that has the minimum number of required parameters among all the members in the superinterfaces, the maximal number of positionals, and the superset of named parameters. The typ es of these are all \DYNAMIC{}. If this is impossible then no member $m$ appears in the interface.
1564 \end{itemize} (\ref{interfaceInheritanceAndOverriding}) 1564 \end{itemize} (\ref{interfaceInheritanceAndOverriding})
1565 \item Rule \ref{typeSigAssignable} applies to interfaces as well as classes (\ ref{interfaceInheritanceAndOverriding}). 1565 \item Rule \ref{typeSigAssignable} applies to interfaces as well as classes (\ ref{interfaceInheritanceAndOverriding}).
1566 \item It is a static warning if a concrete class does not have an implementatio n for a method in any of its superinterfaces unless it declares its own \cd{n oSuchMethod} method (\ref{superinterfaces}) or is annotated with \cd{@proxy}. 1566 \item It is a static warning if a concrete class does not have an implementatio n for a method in any of its superinterfaces unless it declares its own \cd{n oSuchMethod} method (\ref{superinterfaces}).
1567 \item The identifier of a named constructor cannot be the same as the name of a member declared (as opposed to inherited) in the same class (\ref{constructors}) . 1567 \item The identifier of a named constructor cannot be the same as the name of a member declared (as opposed to inherited) in the same class (\ref{constructors}) .
1568 \end{enumerate} 1568 \end{enumerate}
1569 } 1569 }
1570 1570
1571 1571
1572 %Can we have abstract getters and setters? 1572 %Can we have abstract getters and setters?
1573 1573
1574 \subsection{Superinterfaces} 1574 \subsection{Superinterfaces}
1575 \label{superinterfaces} 1575 \label{superinterfaces}
1576 % what about rules about classes that fail to implement their interfaces? 1576 % what about rules about classes that fail to implement their interfaces?
1577 1577
1578 A class has a set of direct superinterfaces. This set includes the interface of its superclass and the interfaces specified in the the \IMPLEMENTS{} clause of the class. 1578 A class has a set of direct superinterfaces. This set includes the interface of its superclass and the interfaces specified in the the \IMPLEMENTS{} clause of the class.
1579 % and any superinterfaces specified by interface injection (\ref{interfaceInject ion}). \Q{The latter needs to be worded carefully - when do interface injection clauses execute and in what scope?} 1579 % and any superinterfaces specified by interface injection (\ref{interfaceInject ion}). \Q{The latter needs to be worded carefully - when do interface injection clauses execute and in what scope?}
1580 1580
1581 \begin{grammar} 1581 \begin{grammar}
1582 {\bf interfaces:} 1582 {\bf interfaces:}
1583 \IMPLEMENTS{} typeList 1583 \IMPLEMENTS{} typeList
1584 . 1584 .
1585 \end{grammar} 1585 \end{grammar}
1586 1586
1587 It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifie s a type variable as a superinterface. It is a compile-time error if the \IMPL EMENTS{} clause of a class $C$ specifies a malformed type as a superinterface It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies type \DYNAMIC{} as a superinterface. It is a compile-time error if the \IMPLEM ENTS{} clause of a class $C$ specifies a type $T$ as a superinterface more than once. 1587 It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifie s a type variable as a superinterface. It is a compile-time error if the \IMPL EMENTS{} clause of a class $C$ specifies a malformed type as a superinterface It is a compile-time error if the \IMPLEMENTS{} clause of a class $C$ specifies type \DYNAMIC{} as a superinterface. It is a compile-time error if the \IMPLEM ENTS{} clause of a class $C$ specifies a type $T$ as a superinterface more than once.
1588 It is a compile-time error if the superclass of a class $C$ is specified as a su perinterface of $C$. 1588 It is a compile-time error if the superclass of a class $C$ is specified as a su perinterface of $C$.
1589 1589
1590 \rationale{ 1590 \rationale{
1591 One might argue that it is harmless to repeat a type in the superinterface list, so why make it an error? The issue is not so much that the situation described in program source is erroneous, but that it is pointless. As such, it is an indi cation that the programmer may very well have meant to say something else - and that is a mistake that should be called to her or his attention. Nevertheless, we could simply issue a warning; and perhaps we should and will. That said, prob lems like these are local and easily corrected on the spot, so we feel justified in taking a harder line. 1591 One might argue that it is harmless to repeat a type in the superinterface list, so why make it an error? The issue is not so much that the situation described in program source is erroneous, but that it is pointless. As such, it is an indi cation that the programmer may very well have meant to say something else - and that is a mistake that should be called to her or his attention. Nevertheless, we could simply issue a warning; and perhaps we should and will. That said, prob lems like these are local and easily corrected on the spot, so we feel justified in taking a harder line.
1592 } 1592 }
1593 1593
1594 It is a compile-time error if the interface of a class $C$ is a superinterface o f itself. 1594 It is a compile-time error if the interface of a class $C$ is a superinterface o f itself.
1595 1595
1596 Let $C$ be a concrete class that does not declare its own \code{noSuchMethod()} method and is not annotated with a metadata declaration of the form \cd{@proxy}, where \cd{proxy} is declared in \cd{dart:core}. 1596 Let $C$ be a concrete class that does not declare its own \code{noSuchMethod()} method.
1597 It is a static warning if the implicit interface of $C$ includes an instance me mber $m$ of type $F$ and $C$ does not declare or inherit a corresponding instanc e member $m$ of type $F'$ such that $F' <: F$. 1597 It is a static warning if the implicit interface of $C$ includes an instance me mber $m$ of type $F$ and $C$ does not declare or inherit a corresponding instanc e member $m$ of type $F'$ such that $F' <: F$.
1598 1598
1599 \commentary{A class does not inherit members from its superinterfaces. However, its implicit interface does. 1599 \commentary{A class does not inherit members from its superinterfaces. However, its implicit interface does.
1600 } 1600 }
1601 1601
1602 1602
1603 \rationale { 1603 \rationale {
1604 We choose to issue these warnings only for concrete classes; an abstract class m ight legitimately be designed with the expectation that concrete subclasses will implement part of the interface. 1604 We choose to issue these warnings only for concrete classes; an abstract class m ight legitimately be designed with the expectation that concrete subclasses will implement part of the interface.
1605 We also disable these warnings if a \code{noSuchMethod()} declaration is present . In such cases, the supported interface is going to be implemented via \code{no SuchMethod()} and no actual declarations of the implemented interface's members are needed. This allows proxy classes for specific types to be implemented witho ut provoking type warnings. 1605 We also disable these warnings if a \code{noSuchMethod()} declaration is present . In such cases, the supported interface is going to be implemented via \code{no SuchMethod()} and no actual declarations of the implemented interface's members are needed. This allows proxy classes for specific types to be implemented witho ut provoking type warnings.
1606 1606
1607 In addition, it may be useful to suppress these warnings if \code{noSuchMethod} is inherited, However, this may suppress meaningful warnings and so we choose no t to do so by default. Instead, a special annotation is defined in \cd{dart:core } for this purpose. 1607 In addition, it may be useful to suppress these warnings if \code{noSuchMethod} is inherited, However, this may suppress meaningful warnings and so we choose no t to do so. If one does want to suppress the warnings in a subclass, one can def ine a simple implementation of \code{noSuchMethod} in the subclass:
1608 } 1608 }
1609 1609
1610 \begin{dartCode}
1611 noSuchMethod(inv) =$>$ \SUPER.noSuchMethod(inv);
1612 \end{dartCode}
1613
1610 It is a static warning if the implicit interface of a class $C$ includes an ins tance member $m$ of type $F$ and $C$ declares or inherits a corresponding instan ce member $m$ of type $F'$ if $F'$ is not a subtype of $F$. 1614 It is a static warning if the implicit interface of a class $C$ includes an ins tance member $m$ of type $F$ and $C$ declares or inherits a corresponding instan ce member $m$ of type $F'$ if $F'$ is not a subtype of $F$.
1611 1615
1612 \rationale{ 1616 \rationale{
1613 However, if a class does explicitly declare a member that conflicts with its sup erinterface, this always yields a static warning. 1617 However, if a class does explicitly declare a member that conflicts with its sup erinterface, this always yields a static warning.
1614 1618
1615 } 1619 }
1616 %It is a static warning if an imported superinterface of a class $C$ declares pr ivate members. 1620 %It is a static warning if an imported superinterface of a class $C$ declares pr ivate members.
1617 1621
1618 % Should we ignore unimplemented private members? 1622 % Should we ignore unimplemented private members?
1619 1623
(...skipping 1547 matching lines...) Expand 10 before | Expand all | Expand 10 after
3167 \item \code{im.isMethod} evaluates to \code{\TRUE{}}. 3171 \item \code{im.isMethod} evaluates to \code{\TRUE{}}.
3168 \item \code{im.memberName} evaluates to \code{'m'}. 3172 \item \code{im.memberName} evaluates to \code{'m'}.
3169 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o_1, \ldots, o_n$]}. 3173 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o_1, \ldots, o_n$]}.
3170 \item \code{im.namedArguments} evaluates to an immutable map with the same keys and values as \code{\{$x_{n+1}: o_{n+1}, \ldots, x_{n+k} : o_{n+k}$\}}. 3174 \item \code{im.namedArguments} evaluates to an immutable map with the same keys and values as \code{\{$x_{n+1}: o_{n+1}, \ldots, x_{n+k} : o_{n+k}$\}}.
3171 \end{itemize} 3175 \end{itemize}
3172 3176
3173 Then the method \code{noSuchMethod()} is looked up in $o$ and invoked with argum ent $im$, and the result of this invocation is the result of evaluating $i$. 3177 Then the method \code{noSuchMethod()} is looked up in $o$ and invoked with argum ent $im$, and the result of this invocation is the result of evaluating $i$.
3174 3178
3175 \commentary{Notice that the wording carefully avoids re-evaluating the receiver $o$ and the arguments $a_i$. } 3179 \commentary{Notice that the wording carefully avoids re-evaluating the receiver $o$ and the arguments $a_i$. }
3176 3180
3177 Let $T$ be the static type of $o$. It is a static type warning if $T$ does not have an accessible (\ref{privacy}) instance member named $m$. If $T.m$ exists , it is a static type warning if the type $F$ of $T.m$ may not be assigned to a function type. If $T.m$ does not exist, or if $F$ is not a function type, the s tatic type of $i$ is \DYNAMIC{}; otherwise the static type of $i$ is the declare d return type of $F$. 3181 Let $T$ be the static type of $o$. It is a static type warning if $T$ does not have an accessible (\ref{privacy}) instance member named $m$ unless $T$ or a su perinterface of $T$ is annotated with an annotation denoting a constant identica l to the constant \code{@proxy} defined in \code{dart:core}. If $T.m$ exists, it is a static type warning if the type $F$ of $T.m$ may not be assigned to a f unction type. If $T.m$ does not exist, or if $F$ is not a function type, the sta tic type of $i$ is \DYNAMIC{}; otherwise the static type of $i$ is the declared return type of $F$.
3178 %\item Let $T_i$ be the static type of $a_i, i \in 1 .. n+k$. It is a static war ning if $F$ is not a supertype of $(T_1, \ldots, T_n, [T_{n+1}$ $x_{n+1}, \ldot s, T_{n+k}$ $x_{n+k}]) \to \bot$. 3182 %\item Let $T_i$ be the static type of $a_i, i \in 1 .. n+k$. It is a static war ning if $F$ is not a supertype of $(T_1, \ldots, T_n, [T_{n+1}$ $x_{n+1}, \ldot s, T_{n+k}$ $x_{n+k}]) \to \bot$.
3179 %\end{itemize} 3183 %\end{itemize}
3180 3184
3181 3185
3182 %\subsubsection{This Invocation} 3186 %\subsubsection{This Invocation}
3183 % Maybe this has no significance the way the language is set up? 3187 % Maybe this has no significance the way the language is set up?
3184 3188
3185 3189
3186 \subsubsection{Cascaded Invocations} 3190 \subsubsection{Cascaded Invocations}
3187 \label{cascadedInvocations} 3191 \label{cascadedInvocations}
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
3263 \begin{itemize} 3267 \begin{itemize}
3264 \item \code{im.isMethod} evaluates to \code{\TRUE{}}. 3268 \item \code{im.isMethod} evaluates to \code{\TRUE{}}.
3265 \item \code{im.memberName} evaluates to \code{'m'}. 3269 \item \code{im.memberName} evaluates to \code{'m'}.
3266 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o_1, \ldots, o_n$]}. 3270 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o_1, \ldots, o_n$]}.
3267 \item \code{im.namedArguments} evaluates to an immutable map with the same keys and values as \code{\{$x_{n+1}: o_{n+1}, \ldots, x_{n+k} : o_{n+k}$\}}. 3271 \item \code{im.namedArguments} evaluates to an immutable map with the same keys and values as \code{\{$x_{n+1}: o_{n+1}, \ldots, x_{n+k} : o_{n+k}$\}}.
3268 \end{itemize} 3272 \end{itemize}
3269 Then the method \code{noSuchMethod()} is looked up in $S$ and invoked on \THIS{} with argument $im$, and the result of this invocation is the result of evaluati ng $i$. 3273 Then the method \code{noSuchMethod()} is looked up in $S$ and invoked on \THIS{} with argument $im$, and the result of this invocation is the result of evaluati ng $i$.
3270 3274
3271 It is a compile-time error if a super method invocation occurs in a top-level fu nction or variable initializer, in an instance variable initializer or initializ er list, in class \code{Object}, in a factory constructor or in a static method or variable initializer. 3275 It is a compile-time error if a super method invocation occurs in a top-level fu nction or variable initializer, in an instance variable initializer or initializ er list, in class \code{Object}, in a factory constructor or in a static method or variable initializer.
3272 3276
3273 It is a static type warning if $S$ does not have an accessible (\ref{privacy}) i nstance member named $m$. If $S.m$ exists, it is a static type warning if the t ype $F$ of $S.m$ may not be assigned to a function type. If $S.m$ does not exist , or if $F$ is not a function type, the static type of $i$ is \DYNAMIC{}; otherw ise the static type of $i$ is the declared return type of $F$. 3277 It is a static type warning if $S$ does not have an accessible (\ref{privacy}) i nstance member named $m$ unless $S$ or a superinterface of $S$ is annotated with an annotation denoting a constant identical to the constant \code{@proxy} defin ed in \code{dart:core}. If $S.m$ exists, it is a static type warning if the typ e $F$ of $S.m$ may not be assigned to a function type. If $S.m$ does not exist, or if $F$ is not a function type, the static type of $i$ is \DYNAMIC{}; otherwis e the static type of $i$ is the declared return type of $F$.
3274 %\item Let $T_i$ be the static type of $a_i, i \in 1 .. n+k$. It is a static war ning if $F$ is not a supertype of $(T_1, \ldots, t_n, [T_{n+1}$ $x_{n+1}, \ldot s, T_{n+k}$ $x_{n+k}]) \to \bot$. 3278 %\item Let $T_i$ be the static type of $a_i, i \in 1 .. n+k$. It is a static war ning if $F$ is not a supertype of $(T_1, \ldots, t_n, [T_{n+1}$ $x_{n+1}, \ldot s, T_{n+k}$ $x_{n+k}]) \to \bot$.
3275 %\end{itemize} 3279 %\end{itemize}
3276 3280
3277 3281
3278 3282
3279 \subsubsection{Sending Messages} 3283 \subsubsection{Sending Messages}
3280 3284
3281 \label{sendingMessages} 3285 \label{sendingMessages}
3282 3286
3283 Messages are the sole means of communication among isolates. Messages are sent b y invoking specific methods in the Dart libraries; there is no specific syntax for sending a message. 3287 Messages are the sole means of communication among isolates. Messages are sent b y invoking specific methods in the Dart libraries; there is no specific syntax for sending a message.
(...skipping 26 matching lines...) Expand all
3310 3314
3311 If the getter lookup has failed, then a new instance $im$ of the predefined cla ss \code{Invocation} is created, such that : 3315 If the getter lookup has failed, then a new instance $im$ of the predefined cla ss \code{Invocation} is created, such that :
3312 \begin{itemize} 3316 \begin{itemize}
3313 \item \code{im.isGetter} evaluates to \code{\TRUE{}}. 3317 \item \code{im.isGetter} evaluates to \code{\TRUE{}}.
3314 \item \code{im.memberName} evaluates to \code{'m'}. 3318 \item \code{im.memberName} evaluates to \code{'m'}.
3315 \item \code{im.positionalArguments} evaluates to the value of \code{\CONST{} []} . 3319 \item \code{im.positionalArguments} evaluates to the value of \code{\CONST{} []} .
3316 \item \code{im.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. 3320 \item \code{im.namedArguments} evaluates to the value of \code{\CONST{} \{\}}.
3317 \end{itemize} 3321 \end{itemize}
3318 Then the method \code{noSuchMethod()} is looked up in $o$ and invoked with argu ment $im$, and the result of this invocation is the result of evaluating $i$. 3322 Then the method \code{noSuchMethod()} is looked up in $o$ and invoked with argu ment $im$, and the result of this invocation is the result of evaluating $i$.
3319 3323
3320 Let $T$ be the static type of $e$. It is a static type warning if $T$ does not have a getter named $m$. The static type of $i$ is the declared return type of $ T.m$, if $T.m$ exists; otherwise the static type of $i$ is \DYNAMIC{}. 3324 Let $T$ be the static type of $e$. It is a static type warning if $T$ does not have a getter named $m$ unless $T$ or a superinterface of $T$ is annotated with an annotation denoting a constant identical to the constant \code{@proxy} define d in \code{dart:core}. The static type of $i$ is the declared return type of $T. m$, if $T.m$ exists; otherwise the static type of $i$ is \DYNAMIC{}.
3321 3325
3322 Evaluation of a getter invocation $i$ of the form $C.m$ proceeds as follows: 3326 Evaluation of a getter invocation $i$ of the form $C.m$ proceeds as follows:
3323 3327
3324 If there is no class $C$ in the enclosing lexical scope of $i$, or if $C$ does not declare, implicitly or explicitly, a getter named $m$, then a \code{NoSuchM ethodError} is thrown. 3328 If there is no class $C$ in the enclosing lexical scope of $i$, or if $C$ does not declare, implicitly or explicitly, a getter named $m$, then a \code{NoSuchM ethodError} is thrown.
3325 Otherwise, the getter function $C.m$ is invoked. The value of $i$ is the result returned by the call to the getter function. 3329 Otherwise, the getter function $C.m$ is invoked. The value of $i$ is the result returned by the call to the getter function.
3326 3330
3327 It is a static warning if there is no class $C$ in the enclosing lexical scope of $i$, or if $C$ does not declare, implicitly or explicitly, a getter named $m $. The static type of $i$ is the declared return type of $C.m$ if it exists or \ DYNAMIC{} otherwise. 3331 It is a static warning if there is no class $C$ in the enclosing lexical scope of $i$, or if $C$ does not declare, implicitly or explicitly, a getter named $m $. The static type of $i$ is the declared return type of $C.m$ if it exists or \ DYNAMIC{} otherwise.
3328 3332
3329 Evaluation of a top-level getter invocation $i$ of the form $m$, where $m$ is an identifier, proceeds as follows: 3333 Evaluation of a top-level getter invocation $i$ of the form $m$, where $m$ is an identifier, proceeds as follows:
3330 3334
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
3416 \item \code{im.isSetter} evaluates to \code{\TRUE{}}. 3420 \item \code{im.isSetter} evaluates to \code{\TRUE{}}.
3417 \item \code{im.memberName} evaluates to \code{'v='}. 3421 \item \code{im.memberName} evaluates to \code{'v='}.
3418 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o_2$]}. 3422 \item \code{im.positionalArguments} evaluates to an immutable list with the same values as \code{[$o_2$]}.
3419 \item \code{im.namedArguments} evaluates to the value of \code{\CONST{} \{\}}. 3423 \item \code{im.namedArguments} evaluates to the value of \code{\CONST{} \{\}}.
3420 \end{itemize} 3424 \end{itemize}
3421 3425
3422 Then the method \code{noSuchMethod()} is looked up in $o_1$ and invoked with ar gument $im$. The value of the assignment expression is $o_2$ irrespective of whe ther setter lookup has failed or succeeded. 3426 Then the method \code{noSuchMethod()} is looked up in $o_1$ and invoked with ar gument $im$. The value of the assignment expression is $o_2$ irrespective of whe ther setter lookup has failed or succeeded.
3423 3427
3424 In checked mode, it is a dynamic type error if $o_2$ is not \NULL{} and the inte rface of the class of $o_2$ is not a subtype of the actual type of $e_1.v$. 3428 In checked mode, it is a dynamic type error if $o_2$ is not \NULL{} and the inte rface of the class of $o_2$ is not a subtype of the actual type of $e_1.v$.
3425 3429
3426 Let $T$ be the static type of $e_1$. It is a static type warning if $T$ does not have an accessible instance setter named $v=$. It is a static type warning if t he static type of $e_2$ may not be assigned to $T$. The static type of the exp ression $e_1v$ \code{=} $e_2$ is the static type of $e_2$. 3430 Let $T$ be the static type of $e_1$. It is a static type warning if $T$ does not have an accessible instance setter named $v=$ unless $T$ or a superinterface of $T$ is annotated with an annotation denoting a constant identical to the consta nt \code{@proxy} defined in \code{dart:core}. It is a static type warning if the static type of $e_2$ may not be assigned to $T$. The static type of the expre ssion $e_1v$ \code{=} $e_2$ is the static type of $e_2$.
3427 3431
3428 Evaluation of an assignment of the form $e_1[e_2]$ \code{=} $e_3$ is equivalent to the evaluation of the expression \code{(a, i, e)\{a.[]=(i, e); \RETURN{} e; \ } ($e_1, e_2, e_3$)}. The static type of the expression $e_1[e_2]$ \code{=} $e_ 3$ is the static type of $e_3$. 3432 Evaluation of an assignment of the form $e_1[e_2]$ \code{=} $e_3$ is equivalent to the evaluation of the expression \code{(a, i, e)\{a.[]=(i, e); \RETURN{} e; \ } ($e_1, e_2, e_3$)}. The static type of the expression $e_1[e_2]$ \code{=} $e_ 3$ is the static type of $e_3$.
3429 3433
3430 % Should we add: It is a dynamic error if $e_1$ evaluates to an constant list o r map. 3434 % Should we add: It is a dynamic error if $e_1$ evaluates to an constant list o r map.
3431 3435
3432 It is as static warning if an assignment of the form $v = e$ occurs inside a top level or static function (be it function, method, getter, or setter) or variabl e initializer and there is neither a local variable declaration with name $v$ n or setter declaration with name $v=$ in the lexical scope enclosing the assignme nt. 3436 It is as static warning if an assignment of the form $v = e$ occurs inside a top level or static function (be it function, method, getter, or setter) or variabl e initializer and there is neither a local variable declaration with name $v$ n or setter declaration with name $v=$ in the lexical scope enclosing the assignme nt.
3433 3437
3434 3438
3435 3439
3436 \subsubsection{Compound Assignment} 3440 \subsubsection{Compound Assignment}
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
3707 The static type of an multiplicative expression is usually determined by the sig nature given in the declaration of the operator used. However, invocations of th e operators \cd{*}, \cd{\%} and \cd{\~{}/} of class \cd{int} are treated specia lly by the typechecker. The static type of an expression $e_1 * e_2$ where $e_1$ has static type \cd{int} is \cd{int} if the static type of $e_2$ is \cd{int}, a nd \cd{double} if the static type of $e_2$ is \cd{double}. The static type of an expression $e_1 \% e_2$ where $e_1$ has static type \cd{int} is \cd{int} if the static type of $e_2$ is \cd{int}, and \cd{double} if the static type of $e_2$ i s \cd{double}. The static type of an expression \cd{$e_1$ \~{}/ $e_2$} where $e _1$ has static type \cd{int} is \cd{int} if the static type of $e_2$ is \cd{int} . 3711 The static type of an multiplicative expression is usually determined by the sig nature given in the declaration of the operator used. However, invocations of th e operators \cd{*}, \cd{\%} and \cd{\~{}/} of class \cd{int} are treated specia lly by the typechecker. The static type of an expression $e_1 * e_2$ where $e_1$ has static type \cd{int} is \cd{int} if the static type of $e_2$ is \cd{int}, a nd \cd{double} if the static type of $e_2$ is \cd{double}. The static type of an expression $e_1 \% e_2$ where $e_1$ has static type \cd{int} is \cd{int} if the static type of $e_2$ is \cd{int}, and \cd{double} if the static type of $e_2$ i s \cd{double}. The static type of an expression \cd{$e_1$ \~{}/ $e_2$} where $e _1$ has static type \cd{int} is \cd{int} if the static type of $e_2$ is \cd{int} .
3708 3712
3709 \subsection{ Unary Expressions} 3713 \subsection{ Unary Expressions}
3710 \label{unaryExpressions} 3714 \label{unaryExpressions}
3711 3715
3712 Unary expressions invoke unary operators on objects. 3716 Unary expressions invoke unary operators on objects.
3713 3717
3714 \begin{grammar} 3718 \begin{grammar}
3715 {\bf unaryExpression:}prefixOperator unaryExpression; 3719 {\bf unaryExpression:}prefixOperator unaryExpression;
3716 postfixExpression; 3720 postfixExpression;
3717 prefixOperator \SUPER{}; 3721 (minusOperator $|$ tildeOperator) \SUPER{};
3718 incrementOperator assignableExpression 3722 incrementOperator assignableExpression
3719 . 3723 .
3720 3724
3721 {\bf prefixOperator:}`-'; 3725 {\bf prefixOperator:}minusOperator;
3722 unaryOperator 3726 negationOperator;
3727 tildeOperator
3723 . 3728 .
3724 3729
3725 {\bf unaryOperator:}`!' ; 3730
3726 `\~{}' 3731 {\bf minusOperator:}`-'; .
3732
3733
3734 {\bf negationOperator:}`!' ;
3735 .
3736
3737 {\bf tildeOperator:} `\~{}'
3727 . 3738 .
3728 3739
3729 3740
3730 \end{grammar} 3741 \end{grammar}
3731 3742
3732 A {\em unary expression} is either aa postfix expression (\ref{postfixExpressio ns}), an invocation of a prefix operator on an expression or an invocation of a unary operator on either \SUPER{} or an expression $e$. 3743 A {\em unary expression} is either a postfix expression (\ref{postfixExpression s}), an invocation of a prefix operator on an expression or an invocation of a u nary operator on either \SUPER{} or an expression $e$.
3733 3744
3734 The expression $!e$ is equivalent to the expression $e? \FALSE{} :\TRUE{}$. 3745 The expression $!e$ is equivalent to the expression $e? \FALSE{} :\TRUE{}$.
3735 3746
3736 Evaluation of an expression of the form \code{++$e$} is equivalent to \code{$e$ += 1}. Evaluation of an expression of the form \code{-{}-$e$} is equivalent to \code{$e$ -= 1}. 3747 Evaluation of an expression of the form \code{++$e$} is equivalent to \code{$e$ += 1}. Evaluation of an expression of the form \code{-{}-$e$} is equivalent to \code{$e$ -= 1}.
3737 3748
3738 %The expression $-e$ is equivalent to the method invocation \code{$e$.-()}. The expression \code{-\SUPER{}} is equivalent to the method invocation \code{\SUPE R{}.-()}. 3749 %The expression $-e$ is equivalent to the method invocation \code{$e$.-()}. The expression \code{-\SUPER{}} is equivalent to the method invocation \code{\SUPE R{}.-()}.
3739 3750
3740 An expression of the form \code{$op$ $e$} is equivalent to the method invocation \code{$e.op()$}. An expression of the form \code{$op$ \SUPER{}} is equivalent t o the method invocation \code{\SUPER{}.$op()$}. 3751 An expression of the form \code{$op$ $e$} is equivalent to the method invocation \code{$e.op()$}. An expression of the form \code{$op$ \SUPER{}} is equivalent t o the method invocation \code{\SUPER{}.$op()$}.
3741 3752
3742 3753
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after
4582 %\commentary{The active stack trace contains the frames between the exception ha ndling code and the original point when an exception is thrown, not where it was rethrown.} 4593 %\commentary{The active stack trace contains the frames between the exception ha ndling code and the original point when an exception is thrown, not where it was rethrown.}
4583 %\end{enumerate} 4594 %\end{enumerate}
4584 4595
4585 \commentary{ 4596 \commentary{
4586 This implies that no synthetic function activations may be added to the trace, n or may any source level activations be omitted. 4597 This implies that no synthetic function activations may be added to the trace, n or may any source level activations be omitted.
4587 This means, for example, that any inlining of functions done as an optimization must not be visible in the trace. Similarly, any synthetic routines used by the implementation must not appear in the trace. 4598 This means, for example, that any inlining of functions done as an optimization must not be visible in the trace. Similarly, any synthetic routines used by the implementation must not appear in the trace.
4588 4599
4589 Nothing is said about how any native function calls may be represented in the tr ace. 4600 Nothing is said about how any native function calls may be represented in the tr ace.
4590 } 4601 }
4591 4602
4603 \commentary{
4604 Note that we say nothing about the identity of the stack trace, or what notion o f equality is defined for stack traces.
4605 }
4592 4606
4593 For each such function activation, the active stack trace includes the name of the function, the bindings of all its formal parameters, local variables and \TH IS{}, and the position at which the function was executing. 4607 % Sadly, the info below cannot be computed efficiently. It would need to be comp uted at the throw point, since at latte points it might be destroyed. Native cod e in calling frames executes relative to the stack pointer, which therefore need s to be reset as each frame is unwound. This means that the
4608 % OS kernel can dispose of this stack memory - it is not reliably preserved. And such code must execute if only to test if the exception should be caught or sen t onward.
4609
4610 % For each such function activation, the active stack trace includes the name of the function, the bindings of all its formal parameters, local variables and \T HIS{}, and the position at which the function was executing.
4594 4611
4595 % Is this controversial? We were thinking of viewing the trace as a List<Invoca tion>, 4612 % Is this controversial? We were thinking of viewing the trace as a List<Invoca tion>,
4596 % but that won't capture the receiver or the locals. More generally, we need a standard interface that describes these traces, so one can type the stack trace variable in the catch. 4613 % but that won't capture the receiver or the locals. More generally, we need a standard interface that describes these traces, so one can type the stack trace variable in the catch.
4597 4614
4598 \commentary{The term position should not be interpreted as a line number, but r ather as a precise position - the exact character index of the expression that raised the exception. } 4615 \commentary{The term position should not be interpreted as a line number, but r ather as a precise position - the exact character index of the expression that raised the exception. }
4599 4616
4600 % A position can be represented via a Token. If we make that part of the core r eflection facility, we can state this here. 4617 % A position can be represented via a Token. If we make that part of the core r eflection facility, we can state this here.
4601 4618
4602 \rationale{The definition below is an attempt to characterize exception handlin g without resorting to a normal/abrupt completion formulation. It has the advant age that one need not specify abrupt completion behavior for every compound stat ement. On the other hand, it is new and different and needs more thought. 4619 \rationale{The definition below is an attempt to characterize exception handlin g without resorting to a normal/abrupt completion formulation. It has the advant age that one need not specify abrupt completion behavior for every compound stat ement. On the other hand, it is new and different and needs more thought.
4603 } 4620 }
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
5024 A library $L$ exports a namespace (\ref{scoping}), meaning that the declarations in the namespace are made available to other libraries if they choose to import $L$ (\ref{imports}). The namespace that $L$ exports is known as its {\em expor ted namespace}. 5041 A library $L$ exports a namespace (\ref{scoping}), meaning that the declarations in the namespace are made available to other libraries if they choose to import $L$ (\ref{imports}). The namespace that $L$ exports is known as its {\em expor ted namespace}.
5025 5042
5026 \begin{grammar} 5043 \begin{grammar}
5027 {\bf libraryExport:} 5044 {\bf libraryExport:}
5028 metadata \EXPORT{} uri combinator* `{\escapegrammar ;}' 5045 metadata \EXPORT{} uri combinator* `{\escapegrammar ;}'
5029 . 5046 .
5030 \end{grammar} 5047 \end{grammar}
5031 5048
5032 An export specifies a URI $x$ where the declaration of an exported library is t o be found. It is a compile-time error if the specified URI does not refer to a library declaration. 5049 An export specifies a URI $x$ where the declaration of an exported library is t o be found. It is a compile-time error if the specified URI does not refer to a library declaration.
5033 5050
5034 We say that a name {\em is exported by a library} (or equivalently, that a libra ry {\em exports a name}) if the name is in the library`s exported namespace. We say that a declaration {\em is exported by a library} (or equivalently, that a l ibrary {\em exports a declaration}) if the declaration is in the library`s expor ted namespace. 5051 We say that a name {\em is exported by a library} (or equivalently, that a libra ry {\em exports a name}) if the name is in the library's exported namespace. We say that a declaration {\em is exported by a library} (or equivalently, that a l ibrary {\em exports a declaration}) if the declaration is in the library`s expor ted namespace.
5035 5052
5036 A library always exports all names and all declarations in its public namespace. In addition, a library may choose to re-export additional libraries via {\em ex port directives}, often referred to simply as {\em exports}. 5053 A library always exports all names and all declarations in its public namespace. In addition, a library may choose to re-export additional libraries via {\em ex port directives}, often referred to simply as {\em exports}.
5037 5054
5038 Let $E$ be an export directive that refers to a URI via the string $s_1$. Evalua tion of $E$ proceeds as follows: 5055 Let $E$ be an export directive that refers to a URI via the string $s_1$. Evalua tion of $E$ proceeds as follows:
5039 5056
5040 First, 5057 First,
5041 5058
5042 \begin{itemize} 5059 \begin{itemize}
5043 \item 5060 \item
5044 If the URI that is the value of $s_1$ has not yet been accessed by an import or export directive in the current isolate then the contents of the URI are comp iled to yield a library $B$. 5061 If the URI that is the value of $s_1$ has not yet been accessed by an import or export directive in the current isolate then the contents of the URI are comp iled to yield a library $B$.
(...skipping 19 matching lines...) Expand all
5064 \item The export from \code{dart:} is implicitly extended by a \code{\HIDE{} $N$ } clause. 5081 \item The export from \code{dart:} is implicitly extended by a \code{\HIDE{} $N$ } clause.
5065 \item A static warning is issued. 5082 \item A static warning is issued.
5066 \end{itemize} 5083 \end{itemize}
5067 5084
5068 \rationale{ 5085 \rationale{
5069 See the discussion in section \ref{imports} for the reasoning behind this rule. 5086 See the discussion in section \ref{imports} for the reasoning behind this rule.
5070 } 5087 }
5071 5088
5072 We say that $L$ {\em re-exports library } $B$, and also that $L$ {\em re-exports namespace } $NS_n$. When no confusion can arise, we may simply state that $L$ { \em re-exports }$B$, or that $L$ {\em re-exports }$NS_n$. 5089 We say that $L$ {\em re-exports library } $B$, and also that $L$ {\em re-exports namespace } $NS_n$. When no confusion can arise, we may simply state that $L$ { \em re-exports }$B$, or that $L$ {\em re-exports }$NS_n$.
5073 5090
5074 It is a compile-time error if a name $N$ is re-exported by a library $L$ and $N$ is introduced into the export namespace of $L$ by more than one export, unless each all exports refer to same declaration for the name $N$. It is a static wa rning to export two different libraries with the same name. 5091 It is a compile-time error if a name $N$ is re-exported by a library $L$ and $N$ is introduced into the export namespace of $L$ by more than one export, unless all exports refer to same declaration for the name $N$. It is a static warnin g to export two different libraries with the same name.
5075 5092
5076 5093
5077 5094
5078 \subsection{Parts} 5095 \subsection{Parts}
5079 \label{parts} 5096 \label{parts}
5080 5097
5081 A library may be divided into {\em parts}, each of which can be stored in a sepa rate location. A library identifies its parts by listing them via \PART{} direct ives. 5098 A library may be divided into {\em parts}, each of which can be stored in a sepa rate location. A library identifies its parts by listing them via \PART{} direct ives.
5082 5099
5083 A {\em part directive} specifies a URI where a Dart compilation unit that should be incorporated into the current library may be found. 5100 A {\em part directive} specifies a URI where a Dart compilation unit that should be incorporated into the current library may be found.
5084 5101
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
5756 5773
5757 Operator precedence is given implicitly by the grammar. 5774 Operator precedence is given implicitly by the grammar.
5758 5775
5759 \commentary{The following non-normative table may be helpful 5776 \commentary{The following non-normative table may be helpful
5760 \newline 5777 \newline
5761 5778
5762 \begin{tabular}{| r | r | r | r |} 5779 \begin{tabular}{| r | r | r | r |}
5763 \hline 5780 \hline
5764 Description & Operator & Associativity & Precedence \\ 5781 Description & Operator & Associativity & Precedence \\
5765 \hline 5782 \hline
5766 Unary postfix & ., ?id, e++, e--, e1[e2], e1() , () & None & 15 \\ 5783 Unary postfix & ., e++, e--, e1[e2], e1() , () & None & 15 \\
5767 \hline 5784 \hline
5768 Unary prefix & -e, !e, \~{}e, ++e, --e & None & 14\\ 5785 Unary prefix & -e, !e, \~{}e, ++e, --e & None & 14\\
5769 \hline 5786 \hline
5770 Multiplicative & *, /, \~/, \% & Left & 13\\ 5787 Multiplicative & *, /, \~/, \% & Left & 13\\
5771 \hline 5788 \hline
5772 Additive & +, - & Left & 12\\ 5789 Additive & +, - & Left & 12\\
5773 \hline 5790 \hline
5774 Shift & $<<$, $>>$& Left & 11\\ 5791 Shift & $<<$, $>>$& Left & 11\\
5775 \hline 5792 \hline
5776 Bitwise AND & \& & Left & 10\\ 5793 Bitwise AND & \& & Left & 10\\
(...skipping 30 matching lines...) Expand all
5807 \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. 5824 \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.
5808 \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 5825 \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
5809 \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. 5826 \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.
5810 \item The names of type variables are short (preferably single letter). Examples : T, S, K, V , E. 5827 \item The names of type variables are short (preferably single letter). Examples : T, S, K, V , E.
5811 \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. 5828 \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.
5812 \end{itemize} 5829 \end{itemize}
5813 } 5830 }
5814 5831
5815 5832
5816 \end{document} 5833 \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