Skip to content

Commit 6181f27

Browse files
committed
Small fixes in section Null Shorting
1 parent 81bb524 commit 6181f27

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
@@ -15519,8 +15519,9 @@ \subsection{Null Shorting}
1551915519
The semantics of the null aware member access operator \lit{?.}
1552015520
is defined in terms of a program transformation known as
1552115521
\Index{null shorting}.
15522-
This program transformation eliminates all occurrences of \lit{?.}
15523-
by introducing \LET{} expressions
15522+
This program transformation transforms expressions
15523+
and leaves other program elements unchanged.
15524+
It eliminates all occurrences of \lit{?.} by introducing \LET{} expressions
1552415525
(\ref{notation})
1552515526
and equality comparisons with \NULL.
1552615527
Null shorting is performed after the static analysis,
@@ -15530,8 +15531,8 @@ \subsection{Null Shorting}
1553015531
\LMHash{}%
1553115532
We use the phrase null-shorting as an adjective in order to
1553215533
indicate the connections between null shorting and other concepts
15533-
(\commentary{
15534-
e.g., the null-shorting translation plays an important role in null shorting%
15534+
(\commentary{%
15535+
e.g., ``the null-shorting translation is used during null shorting''%
1553515536
}).
1553615537

1553715538
\commentary{%
@@ -15568,7 +15569,7 @@ \subsection{Null Shorting}
1556815569
\IndexCustom{base-level}{null shorting!base-level}
1556915570
to indicate that a term is Dart syntax,
1557015571
as opposed to meta-level syntax.
15571-
\commentary{For example, \code{x\,\,+\,\,1}.}
15572+
\commentary{For example, \code{x\,\,+\,\,1} is a base-level expression.}
1557215573

1557315574
\LMHash{}%
1557415575
\metaCode{fn[x:\,\,Exp]:\,\,Exp\,\,=>\,\,E}
@@ -15578,7 +15579,7 @@ \subsection{Null Shorting}
1557815579
and
1557915580
\metaCode{fn[k:\,\,Exp\,\,$\rightarrow$\,\,Exp]:\,\,Exp\,\,=>\,\,E}
1558015581
defines a meta-level function of type
15581-
\metaCode{Exp\,\,$\rightarrow$\,\,Exp\,\,$\rightarrow$\,\,Exp}.
15582+
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp}.
1558215583
Where obvious from context,
1558315584
we elide the parameter and return types on the meta-level functions.
1558415585
The meta-variables \metaCode{F} and \metaCode{G}
@@ -15587,12 +15588,11 @@ \subsection{Null Shorting}
1558715588
is written as \metaCode{F[p]}.
1558815589

1558915590
\LMHash{}%
15590-
Null shorting transforms an expression \metaCode{e}
15591-
(\commentary{whose meta-level type is \code{Exp}})
15591+
Null shorting transforms an expression $e$
1559215592
into a meta-level function \metaCode{F} of type
1559315593
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp},
15594-
which takes as an argument the continuation of \metaCode{e},
15595-
and produces an expression semantically equivalent to \metaCode{e}
15594+
which takes as an argument the continuation of $e$,
15595+
and produces an expression semantically equivalent to $e$
1559615596
with all occurrences of \metaCode{?.} eliminated
1559715597
in favor of explicit sequencing using \LET{} expressions.
1559815598

@@ -15604,27 +15604,31 @@ \subsection{Null Shorting}
1560415604

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

1561415616
\LMHash{}%
1561515617
We use
15616-
\IndexCustom{\metaCode{EXP(e)}}{null shorting!\metaCode{EXP(e)}}
15618+
\IndexCustom{\metaCode{EXP(\textcolor{normativeColor}{$e$})}}{%
15619+
null shorting!\metaCode{EXP(\textcolor{normativeColor}{$e$})}}
1561715620
as a shorthand for
15618-
the expression translation of \metaCode{e}.
15619-
That is, if the null-shorting translation of \metaCode{e} is \metaCode{F},
15620-
then \metaCode{EXP(e)} is \metaCode{F[ID]}.
15621+
the expression translation of $e$.
15622+
That is, if the null-shorting translation of $e$ is \metaCode{F},
15623+
then \metaCode{EXP(\textcolor{normativeColor}{$e$})} is \metaCode{F[ID]}.
1562115624

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

1562915633
\LMHash{}%
1563015634
We use three combinators to express the translation.
@@ -15657,7 +15661,7 @@ \subsection{Null Shorting}
1565715661
bound to the result of evaluating the receiver,
1565815662
produces the final expression.
1565915663
The result is parameterized over the continuation of
15660-
the expression being translated.
15664+
the expression being translated (\metaCode{k}).
1566115665
The continuation is only called in the case that
1566215666
the result of evaluating the receiver is non-null.
1566315667

@@ -15857,8 +15861,8 @@ \subsection{Null Shorting}
1585715861
\commentary{%
1585815862
\begin{itemize}
1585915863
\item
15860-
A list literal \Base{\code{[\,$e_1$, \ldots, $e_n$\,]}}
15861-
translates to\\
15864+
A list literal \Base{\code{[\List{e}{1}{n}]}}
15865+
translates to
1586215866
\metaCode{TERM[\Base{[\,%
1586315867
\Meta{EXP(\Base{$e_1$}), \ldots, EXP(\Base{$e_n$})}\,]}]}.
1586415868
\item

0 commit comments

Comments
 (0)