Skip to content

Commit 4cf7565

Browse files
committed
Small fixes in section Null Shorting
1 parent 0c63467 commit 4cf7565

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
@@ -15607,8 +15607,9 @@ \subsection{Null Shorting}
1560715607
The semantics of the null aware member access operator \lit{?.}
1560815608
is defined in terms of a program transformation known as
1560915609
\Index{null shorting}.
15610-
This program transformation eliminates all occurrences of \lit{?.}
15611-
by introducing \LET{} expressions
15610+
This program transformation transforms expressions
15611+
and leaves other program elements unchanged.
15612+
It eliminates all occurrences of \lit{?.} by introducing \LET{} expressions
1561215613
(\ref{notation})
1561315614
and equality comparisons with \NULL.
1561415615
Null shorting is performed after the static analysis,
@@ -15618,8 +15619,8 @@ \subsection{Null Shorting}
1561815619
\LMHash{}%
1561915620
We use the phrase null-shorting as an adjective in order to
1562015621
indicate the connections between null shorting and other concepts
15621-
(\commentary{
15622-
e.g., the null-shorting translation plays an important role in null shorting%
15622+
(\commentary{%
15623+
e.g., ``the null-shorting translation is used during null shorting''%
1562315624
}).
1562415625

1562515626
\commentary{%
@@ -15656,7 +15657,7 @@ \subsection{Null Shorting}
1565615657
\IndexCustom{base-level}{null shorting!base-level}
1565715658
to indicate that a term is Dart syntax,
1565815659
as opposed to meta-level syntax.
15659-
\commentary{For example, \code{x\,\,+\,\,1}.}
15660+
\commentary{For example, \code{x\,\,+\,\,1} is a base-level expression.}
1566015661

1566115662
\LMHash{}%
1566215663
\metaCode{fn[x:\,\,Exp]:\,\,Exp\,\,=>\,\,E}
@@ -15666,7 +15667,7 @@ \subsection{Null Shorting}
1566615667
and
1566715668
\metaCode{fn[k:\,\,Exp\,\,$\rightarrow$\,\,Exp]:\,\,Exp\,\,=>\,\,E}
1566815669
defines a meta-level function of type
15669-
\metaCode{Exp\,\,$\rightarrow$\,\,Exp\,\,$\rightarrow$\,\,Exp}.
15670+
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp}.
1567015671
Where obvious from context,
1567115672
we elide the parameter and return types on the meta-level functions.
1567215673
The meta-variables \metaCode{F} and \metaCode{G}
@@ -15675,12 +15676,11 @@ \subsection{Null Shorting}
1567515676
is written as \metaCode{F[p]}.
1567615677

1567715678
\LMHash{}%
15678-
Null shorting transforms an expression \metaCode{e}
15679-
(\commentary{whose meta-level type is \code{Exp}})
15679+
Null shorting transforms an expression $e$
1568015680
into a meta-level function \metaCode{F} of type
1568115681
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp},
15682-
which takes as an argument the continuation of \metaCode{e},
15683-
and produces an expression semantically equivalent to \metaCode{e}
15682+
which takes as an argument the continuation of $e$,
15683+
and produces an expression semantically equivalent to $e$
1568415684
with all occurrences of \metaCode{?.} eliminated
1568515685
in favor of explicit sequencing using \LET{} expressions.
1568615686

@@ -15692,27 +15692,31 @@ \subsection{Null Shorting}
1569215692

1569315693
\LMHash{}%
1569415694
The
15695-
\IndexCustom{expression translation}{null shorting!expression translation}
15696-
of an expression \metaCode{e} is
15697-
the result of applying the null-shorting translation
15698-
of \metaCode{e} to \metaCode{ID}.
15699-
That is, if \metaCode{e} translates to \metaCode{F},
15700-
then \metaCode{F[ID]} is the expression translation of \metaCode{e}.
15695+
\IndexCustom{null-shorting expression translation}{%
15696+
null shorting!expression translation}
15697+
of an expression $e$
15698+
(in this section abbreviated as the \NoIndex{expression translation} of $e$)
15699+
is the result of applying the null-shorting translation (defined below)
15700+
of $e$ to \metaCode{ID}.
15701+
That is, if $e$ translates to \metaCode{F},
15702+
then \metaCode{F[ID]} is the expression translation of $e$.
1570115703

1570215704
\LMHash{}%
1570315705
We use
15704-
\IndexCustom{\metaCode{EXP(e)}}{null shorting!\metaCode{EXP(e)}}
15706+
\IndexCustom{\metaCode{EXP(\textcolor{normativeColor}{$e$})}}{%
15707+
null shorting!\metaCode{EXP(\textcolor{normativeColor}{$e$})}}
1570515708
as a shorthand for
15706-
the expression translation of \metaCode{e}.
15707-
That is, if the null-shorting translation of \metaCode{e} is \metaCode{F},
15708-
then \metaCode{EXP(e)} is \metaCode{F[ID]}.
15709+
the expression translation of $e$.
15710+
That is, if the null-shorting translation of $e$ is \metaCode{F},
15711+
then \metaCode{EXP(\textcolor{normativeColor}{$e$})} is \metaCode{F[ID]}.
1570915712

1571015713
\LMHash{}%
1571115714
We extend the expression translation to argument lists in the obvious way,
1571215715
using
15713-
\IndexCustom{\metaCode{ARGS(args)}}{null shorting!\metaCode{ARGS(args)}}
15716+
\IndexCustom{\metaCode{ARGS(\textcolor{normativeColor}{\metavar{args}})}}{%
15717+
null shorting!\metaCode{ARGS(\textcolor{normativeColor}{\metavar{args}})}}
1571415718
to denote the result of applying the expression translation pointwise
15715-
to the arguments in the argument list \metaCode{args}.
15719+
to the arguments in the argument list \metavar{args}.
1571615720

1571715721
\LMHash{}%
1571815722
We use three combinators to express the translation.
@@ -15745,7 +15749,7 @@ \subsection{Null Shorting}
1574515749
bound to the result of evaluating the receiver,
1574615750
produces the final expression.
1574715751
The result is parameterized over the continuation of
15748-
the expression being translated.
15752+
the expression being translated (\metaCode{k}).
1574915753
The continuation is only called in the case that
1575015754
the result of evaluating the receiver is non-null.
1575115755

@@ -15945,8 +15949,8 @@ \subsection{Null Shorting}
1594515949
\commentary{%
1594615950
\begin{itemize}
1594715951
\item
15948-
A list literal \Base{\code{[\,$e_1$, \ldots, $e_n$\,]}}
15949-
translates to\\
15952+
A list literal \Base{\code{[\List{e}{1}{n}]}}
15953+
translates to
1595015954
\metaCode{TERM[\Base{[\,%
1595115955
\Meta{EXP(\Base{$e_1$}), \ldots, EXP(\Base{$e_n$})}\,]}]}.
1595215956
\item

0 commit comments

Comments
 (0)