Skip to content

Commit dd1634c

Browse files
committed
Small fixes in section Null Shorting
1 parent 4389739 commit dd1634c

File tree

1 file changed

+29
-25
lines changed

1 file changed

+29
-25
lines changed

specification/dartLangSpec.tex

Lines changed: 29 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -15679,8 +15679,9 @@ \subsection{Null Shorting}
1567915679
The semantics of the null aware member access operator \lit{?.}
1568015680
is defined in terms of a program transformation known as
1568115681
\Index{null shorting}.
15682-
This program transformation eliminates all occurrences of \lit{?.}
15683-
by introducing \LET{} expressions
15682+
This program transformation transforms expressions
15683+
and leaves other program elements unchanged.
15684+
It eliminates all occurrences of \lit{?.} by introducing \LET{} expressions
1568415685
(\ref{notation})
1568515686
and equality comparisons with \NULL.
1568615687
Null shorting is performed after the static analysis,
@@ -15690,8 +15691,8 @@ \subsection{Null Shorting}
1569015691
\LMHash{}%
1569115692
We use the phrase null-shorting as an adjective in order to
1569215693
indicate the connections between null shorting and other concepts
15693-
(\commentary{
15694-
e.g., the null-shorting translation plays an important role in null shorting%
15694+
(\commentary{%
15695+
e.g., ``the null-shorting translation is used during null shorting''%
1569515696
}).
1569615697

1569715698
\commentary{%
@@ -15728,7 +15729,7 @@ \subsection{Null Shorting}
1572815729
\IndexCustom{base-level}{null shorting!base-level}
1572915730
to indicate that a term is Dart syntax,
1573015731
as opposed to meta-level syntax.
15731-
\commentary{For example, \code{x\,\,+\,\,1}.}
15732+
\commentary{For example, \code{x\,\,+\,\,1} is a base-level expression.}
1573215733

1573315734
\LMHash{}%
1573415735
\metaCode{fn[x:\,\,Exp]:\,\,Exp\,\,=>\,\,E}
@@ -15738,7 +15739,7 @@ \subsection{Null Shorting}
1573815739
and
1573915740
\metaCode{fn[k:\,\,Exp\,\,$\rightarrow$\,\,Exp]:\,\,Exp\,\,=>\,\,E}
1574015741
defines a meta-level function of type
15741-
\metaCode{Exp\,\,$\rightarrow$\,\,Exp\,\,$\rightarrow$\,\,Exp}.
15742+
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp}.
1574215743
Where obvious from context,
1574315744
we elide the parameter and return types on the meta-level functions.
1574415745
The meta-variables \metaCode{F} and \metaCode{G}
@@ -15747,12 +15748,11 @@ \subsection{Null Shorting}
1574715748
is written as \metaCode{F[p]}.
1574815749

1574915750
\LMHash{}%
15750-
Null shorting transforms an expression \metaCode{e}
15751-
(\commentary{whose meta-level type is \code{Exp}})
15751+
Null shorting transforms an expression $e$
1575215752
into a meta-level function \metaCode{F} of type
1575315753
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp},
15754-
which takes as an argument the continuation of \metaCode{e},
15755-
and produces an expression semantically equivalent to \metaCode{e}
15754+
which takes as an argument the continuation of $e$,
15755+
and produces an expression semantically equivalent to $e$
1575615756
with all occurrences of \metaCode{?.} eliminated
1575715757
in favor of explicit sequencing using \LET{} expressions.
1575815758

@@ -15764,27 +15764,31 @@ \subsection{Null Shorting}
1576415764

1576515765
\LMHash{}%
1576615766
The
15767-
\IndexCustom{expression translation}{null shorting!expression translation}
15768-
of an expression \metaCode{e} is
15769-
the result of applying the null-shorting translation
15770-
of \metaCode{e} to \metaCode{ID}.
15771-
That is, if \metaCode{e} translates to \metaCode{F},
15772-
then \metaCode{F[ID]} is the expression translation of \metaCode{e}.
15767+
\IndexCustom{null-shorting expression translation}{%
15768+
null shorting!expression translation}
15769+
of an expression $e$
15770+
(in this section abbreviated as the \NoIndex{expression translation} of $e$)
15771+
is the result of applying the null-shorting translation (defined below)
15772+
of $e$ to \metaCode{ID}.
15773+
That is, if $e$ translates to \metaCode{F},
15774+
then \metaCode{F[ID]} is the expression translation of $e$.
1577315775

1577415776
\LMHash{}%
1577515777
We use
15776-
\IndexCustom{\metaCode{EXP(e)}}{null shorting!\metaCode{EXP(e)}}
15778+
\IndexCustom{\metaCode{EXP(\textcolor{normativeColor}{$e$})}}{%
15779+
null shorting!\metaCode{EXP(\textcolor{normativeColor}{$e$})}}
1577715780
as a shorthand for
15778-
the expression translation of \metaCode{e}.
15779-
That is, if the null-shorting translation of \metaCode{e} is \metaCode{F},
15780-
then \metaCode{EXP(e)} is \metaCode{F[ID]}.
15781+
the expression translation of $e$.
15782+
That is, if the null-shorting translation of $e$ is \metaCode{F},
15783+
then \metaCode{EXP(\textcolor{normativeColor}{$e$})} is \metaCode{F[ID]}.
1578115784

1578215785
\LMHash{}%
1578315786
We extend the expression translation to argument lists in the obvious way,
1578415787
using
15785-
\IndexCustom{\metaCode{ARGS(args)}}{null shorting!\metaCode{ARGS(args)}}
15788+
\IndexCustom{\metaCode{ARGS(\textcolor{normativeColor}{\metavar{args}})}}{%
15789+
null shorting!\metaCode{ARGS(\textcolor{normativeColor}{\metavar{args}})}}
1578615790
to denote the result of applying the expression translation pointwise
15787-
to the arguments in the argument list \metaCode{args}.
15791+
to the arguments in the argument list \metavar{args}.
1578815792

1578915793
\LMHash{}%
1579015794
We use three combinators to express the translation.
@@ -15817,7 +15821,7 @@ \subsection{Null Shorting}
1581715821
bound to the result of evaluating the receiver,
1581815822
produces the final expression.
1581915823
The result is parameterized over the continuation of
15820-
the expression being translated.
15824+
the expression being translated (\metaCode{k}).
1582115825
The continuation is only called in the case that
1582215826
the result of evaluating the receiver is non-null.
1582315827

@@ -16017,8 +16021,8 @@ \subsection{Null Shorting}
1601716021
\commentary{%
1601816022
\begin{itemize}
1601916023
\item
16020-
A list literal \Base{\code{[\,$e_1$, \ldots, $e_n$\,]}}
16021-
translates to\\
16024+
A list literal \Base{\code{[\List{e}{1}{n}]}}
16025+
translates to
1602216026
\metaCode{TERM[\Base{[\,%
1602316027
\Meta{EXP(\Base{$e_1$}), \ldots, EXP(\Base{$e_n$})}\,]}]}.
1602416028
\item

0 commit comments

Comments
 (0)