Skip to content

Commit 187eefc

Browse files
committed
Small fixes in section Null Shorting
1 parent 45a1337 commit 187eefc

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
@@ -15521,8 +15521,9 @@ \subsection{Null Shorting}
1552115521
The semantics of the null aware member access operator \lit{?.}
1552215522
is defined in terms of a program transformation known as
1552315523
\Index{null shorting}.
15524-
This program transformation eliminates all occurrences of \lit{?.}
15525-
by introducing \LET{} expressions
15524+
This program transformation transforms expressions
15525+
and leaves other program elements unchanged.
15526+
It eliminates all occurrences of \lit{?.} by introducing \LET{} expressions
1552615527
(\ref{notation})
1552715528
and equality comparisons with \NULL.
1552815529
Null shorting is performed after the static analysis,
@@ -15532,8 +15533,8 @@ \subsection{Null Shorting}
1553215533
\LMHash{}%
1553315534
We use the phrase null-shorting as an adjective in order to
1553415535
indicate the connections between null shorting and other concepts
15535-
(\commentary{
15536-
e.g., the null-shorting translation plays an important role in null shorting%
15536+
(\commentary{%
15537+
e.g., ``the null-shorting translation is used during null shorting''%
1553715538
}).
1553815539

1553915540
\commentary{%
@@ -15570,7 +15571,7 @@ \subsection{Null Shorting}
1557015571
\IndexCustom{base-level}{null shorting!base-level}
1557115572
to indicate that a term is Dart syntax,
1557215573
as opposed to meta-level syntax.
15573-
\commentary{For example, \code{x\,\,+\,\,1}.}
15574+
\commentary{For example, \code{x\,\,+\,\,1} is a base-level expression.}
1557415575

1557515576
\LMHash{}%
1557615577
\metaCode{fn[x:\,\,Exp]:\,\,Exp\,\,=>\,\,E}
@@ -15580,7 +15581,7 @@ \subsection{Null Shorting}
1558015581
and
1558115582
\metaCode{fn[k:\,\,Exp\,\,$\rightarrow$\,\,Exp]:\,\,Exp\,\,=>\,\,E}
1558215583
defines a meta-level function of type
15583-
\metaCode{Exp\,\,$\rightarrow$\,\,Exp\,\,$\rightarrow$\,\,Exp}.
15584+
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp}.
1558415585
Where obvious from context,
1558515586
we elide the parameter and return types on the meta-level functions.
1558615587
The meta-variables \metaCode{F} and \metaCode{G}
@@ -15589,12 +15590,11 @@ \subsection{Null Shorting}
1558915590
is written as \metaCode{F[p]}.
1559015591

1559115592
\LMHash{}%
15592-
Null shorting transforms an expression \metaCode{e}
15593-
(\commentary{whose meta-level type is \code{Exp}})
15593+
Null shorting transforms an expression $e$
1559415594
into a meta-level function \metaCode{F} of type
1559515595
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp},
15596-
which takes as an argument the continuation of \metaCode{e},
15597-
and produces an expression semantically equivalent to \metaCode{e}
15596+
which takes as an argument the continuation of $e$,
15597+
and produces an expression semantically equivalent to $e$
1559815598
with all occurrences of \metaCode{?.} eliminated
1559915599
in favor of explicit sequencing using \LET{} expressions.
1560015600

@@ -15606,27 +15606,31 @@ \subsection{Null Shorting}
1560615606

1560715607
\LMHash{}%
1560815608
The
15609-
\IndexCustom{expression translation}{null shorting!expression translation}
15610-
of an expression \metaCode{e} is
15611-
the result of applying the null-shorting translation
15612-
of \metaCode{e} to \metaCode{ID}.
15613-
That is, if \metaCode{e} translates to \metaCode{F},
15614-
then \metaCode{F[ID]} is the expression translation of \metaCode{e}.
15609+
\IndexCustom{null-shorting expression translation}{%
15610+
null shorting!expression translation}
15611+
of an expression $e$
15612+
(in this section abbreviated as the \NoIndex{expression translation} of $e$)
15613+
is the result of applying the null-shorting translation (defined below)
15614+
of $e$ to \metaCode{ID}.
15615+
That is, if $e$ translates to \metaCode{F},
15616+
then \metaCode{F[ID]} is the expression translation of $e$.
1561515617

1561615618
\LMHash{}%
1561715619
We use
15618-
\IndexCustom{\metaCode{EXP(e)}}{null shorting!\metaCode{EXP(e)}}
15620+
\IndexCustom{\metaCode{EXP(\textcolor{normativeColor}{$e$})}}{%
15621+
null shorting!\metaCode{EXP(\textcolor{normativeColor}{$e$})}}
1561915622
as a shorthand for
15620-
the expression translation of \metaCode{e}.
15621-
That is, if the null-shorting translation of \metaCode{e} is \metaCode{F},
15622-
then \metaCode{EXP(e)} is \metaCode{F[ID]}.
15623+
the expression translation of $e$.
15624+
That is, if the null-shorting translation of $e$ is \metaCode{F},
15625+
then \metaCode{EXP(\textcolor{normativeColor}{$e$})} is \metaCode{F[ID]}.
1562315626

1562415627
\LMHash{}%
1562515628
We extend the expression translation to argument lists in the obvious way,
1562615629
using
15627-
\IndexCustom{\metaCode{ARGS(args)}}{null shorting!\metaCode{ARGS(args)}}
15630+
\IndexCustom{\metaCode{ARGS(\textcolor{normativeColor}{\metavar{args}})}}{%
15631+
null shorting!\metaCode{ARGS(\textcolor{normativeColor}{\metavar{args}})}}
1562815632
to denote the result of applying the expression translation pointwise
15629-
to the arguments in the argument list \metaCode{args}.
15633+
to the arguments in the argument list \metavar{args}.
1563015634

1563115635
\LMHash{}%
1563215636
We use three combinators to express the translation.
@@ -15659,7 +15663,7 @@ \subsection{Null Shorting}
1565915663
bound to the result of evaluating the receiver,
1566015664
produces the final expression.
1566115665
The result is parameterized over the continuation of
15662-
the expression being translated.
15666+
the expression being translated (\metaCode{k}).
1566315667
The continuation is only called in the case that
1566415668
the result of evaluating the receiver is non-null.
1566515669

@@ -15859,8 +15863,8 @@ \subsection{Null Shorting}
1585915863
\commentary{%
1586015864
\begin{itemize}
1586115865
\item
15862-
A list literal \Base{\code{[\,$e_1$, \ldots, $e_n$\,]}}
15863-
translates to\\
15866+
A list literal \Base{\code{[\List{e}{1}{n}]}}
15867+
translates to
1586415868
\metaCode{TERM[\Base{[\,%
1586515869
\Meta{EXP(\Base{$e_1$}), \ldots, EXP(\Base{$e_n$})}\,]}]}.
1586615870
\item

0 commit comments

Comments
 (0)