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

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

Issue 2060163002: Add trailing commas to argument and parameter lists. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Address comments Created 4 years, 5 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 \newcommand{\code}[1]{{\sf #1}} 8 \newcommand{\code}[1]{{\sf #1}}
9 \title{Dart Programming Language Specification \\ 9 \title{Dart Programming Language Specification \\
10 {4th edition draft}\\ 10 {4th edition draft}\\
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 648
649 %The formal parameter scope of a function maps the name of each formal parameter $p$ to the value $p$ is bound to. 649 %The formal parameter scope of a function maps the name of each formal parameter $p$ to the value $p$ is bound to.
650 650
651 % The formal parameters of a function are processed in the enclosing scope of th e function. 651 % The formal parameters of a function are processed in the enclosing scope of th e function.
652 % \commentary{this means that the parameters themselves may not be referenced wi thin the formal parameter list.} 652 % \commentary{this means that the parameters themselves may not be referenced wi thin the formal parameter list.}
653 653
654 \LMHash{} 654 \LMHash{}
655 It is a compile-time error if a formal parameter is declared as a constant varia ble (\ref{variables}). 655 It is a compile-time error if a formal parameter is declared as a constant varia ble (\ref{variables}).
656 656
657 \begin{grammar} 657 \begin{grammar}
658 {\bf formalParameterList:}`(' `)'; 658 {\bf formalParameterList:}
659 `(' normalFormalParameters ( `,' optionalFormalParameters)? `)'; 659 `(' `)';
660 `(' optionalFormalParameters `)' 660 `(' normalFormalParameters `,'? `)';
661 `(' normalFormalParameters `,' optionalFormalParameters `)';
662 `(' optionalFormalParameters `)'
661 . 663 .
662 %\end{grammar} 664 %\end{grammar}
663 %} 665 %}
664 666
665 %\begin{grammar} 667 %\begin{grammar}
666 %formalParameterList: 668 %formalParameterList:
667 % '(' restFormalParameter? ')'; 669 % '(' restFormalParameter? ')';
668 % '(' namedFormalParameters ')'; 670 % '(' namedFormalParameters ')';
669 % '(' normalFormalParameters normalFormalParameterTail? ')' 671 % '(' normalFormalParameters normalFormalParameterTail? ')'
670 % . 672 % .
671 673
672 {\bf normalFormalParameters:} 674 {\bf normalFormalParameters:}
673 normalFormalParameter (`,' normalFormalParameter)* 675 normalFormalParameter (`,' normalFormalParameter)*
674 . 676 .
675 677
676 {\bf optionalFormalParameters:}optionalPositionalFormalParameters; 678 {\bf optionalFormalParameters:}
679 optionalPositionalFormalParameters;
677 namedFormalParameters 680 namedFormalParameters
678 . 681 .
679 682
680 {\bf optionalPositionalFormalParameters:} 683 {\bf optionalPositionalFormalParameters:}
681 `[' defaultFormalParameter (`,' defaultFormalParameter)* `]' 684 `[' defaultFormalParameter (`,' defaultFormalParameter)* `,'? `]'
682 . 685 .
683 {\bf namedFormalParameters:} 686 {\bf namedFormalParameters:}
684 `\{' defaultNamedParameter (`,' defaultNamedParameter)* `\}' 687 `\{' defaultNamedParameter (`,' defaultNamedParameter)* `,'? `\}'
685 . 688 .
686 \end{grammar} 689 \end{grammar}
687 690
691 Formal parameter lists allow an optional trailing comma after the last parameter ($`,'?$). A parameter list with such a trailing comma is equivalent in all ways to the same parameter list without the trailing comma. All parameter lists in t his specification are shown without a trailing comma, but the rules and semantic s apply equally to the corresponding parameter list with a trailing comma.
692
688 %Formal parameters are always \FINAL{}. 693 %Formal parameters are always \FINAL{}.
689 %\Q{We're awaiting some data on whether enforcing this would cause widespread pa in.} 694 %\Q{We're awaiting some data on whether enforcing this would cause widespread pa in.}
690 %A formal parameter is always considered to be initialized. \rationale{This is because it will always be initialized by the call - even if it is optional.} 695 %A formal parameter is always considered to be initialized. \rationale{This is because it will always be initialized by the call - even if it is optional.}
691 696
692 697
693 \subsubsection{Required Formals} 698 \subsubsection{Required Formals}
694 \LMLabel{requiredFormals} 699 \LMLabel{requiredFormals}
695 700
696 \LMHash{} 701 \LMHash{}
697 A {\em required formal parameter} may be specified in one of three ways: 702 A {\em required formal parameter} may be specified in one of three ways:
(...skipping 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after
3601 3606
3602 3607
3603 \subsubsection{ Actual Argument List Evaluation} 3608 \subsubsection{ Actual Argument List Evaluation}
3604 \LMLabel{actualArguments} 3609 \LMLabel{actualArguments}
3605 3610
3606 \LMHash{} 3611 \LMHash{}
3607 Function invocation involves evaluation of the list of actual arguments to the f unction and binding of the results to the function's formal parameters. 3612 Function invocation involves evaluation of the list of actual arguments to the f unction and binding of the results to the function's formal parameters.
3608 3613
3609 \begin{grammar} 3614 \begin{grammar}
3610 {\bf arguments:} 3615 {\bf arguments:}
3611 `(' argumentList? `)' 3616 `(' (argumentList `,'?)? `)'
3612 . 3617 .
3613 3618
3614 {\bf argumentList:}namedArgument (`,' namedArgument)*; 3619 {\bf argumentList:}
3620 namedArgument (`,' namedArgument)*;
3615 % expressionList ',' spreadArgument; 3621 % expressionList ',' spreadArgument;
3616 expressionList (`,' namedArgument)* 3622 expressionList (`,' namedArgument)*
3617 % spreadArgument 3623 % spreadArgument
3618 . 3624 .
3619 3625
3620 {\bf namedArgument:} 3626 {\bf namedArgument:}
3621 label expression % could be top level expression? 3627 label expression % could be top level expression?
3622 . 3628 .
3623 \end{grammar} 3629 \end{grammar}
3624 3630
3631 Argument lists allow an optional trailing comma after the last argument ($`,'?$) . An argument list with such a trailing comma is equivalent in all ways to the s ame parameter list without the trailing comma. All argument lists in this specif ication are shown without a trailing comma, but the rules and semantics apply eq ually to the corresponding argument list with a trailing comma.
3632
3625 \LMHash{} 3633 \LMHash{}
3626 Evaluation of an actual argument list of the form 3634 Evaluation of an actual argument list of the form
3627 3635
3628 $(a_1, \ldots, a_m, q_1: a_{m+1}, \ldots, q_l: a_{m+l})$ 3636 $(a_1, \ldots, a_m, q_1: a_{m+1}, \ldots, q_l: a_{m+l})$
3629 3637
3630 proceeds as follows: 3638 proceeds as follows:
3631 3639
3632 \LMHash{} 3640 \LMHash{}
3633 The arguments $a_1, \ldots, a_{m+l}$ are evaluated in the order they appear in t he program, yielding objects $o_1, \ldots, o_{m+l}$. 3641 The arguments $a_1, \ldots, a_{m+l}$ are evaluated in the order they appear in t he program, yielding objects $o_1, \ldots, o_{m+l}$.
3634 3642
(...skipping 4246 matching lines...) Expand 10 before | Expand all | Expand 10 after
7881 7889
7882 The invariant that each normative paragraph is associated with a line 7890 The invariant that each normative paragraph is associated with a line
7883 containing the text \LMHash{} should be maintained. Extra occurrences 7891 containing the text \LMHash{} should be maintained. Extra occurrences
7884 of \LMHash{} can be added if needed, e.g., in order to make 7892 of \LMHash{} can be added if needed, e.g., in order to make
7885 individual \item{}s in itemized lists addressable. Each \LM.. command 7893 individual \item{}s in itemized lists addressable. Each \LM.. command
7886 must occur on a separate line. \LMHash{} must occur immediately 7894 must occur on a separate line. \LMHash{} must occur immediately
7887 before the associated paragraph, and \LMLabel must occur immediately 7895 before the associated paragraph, and \LMLabel must occur immediately
7888 after the associated \section{}, \subsection{} etc. 7896 after the associated \section{}, \subsection{} etc.
7889 7897
7890 ---------------------------------------------------------------------- 7898 ----------------------------------------------------------------------
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