@@ -15607,8 +15607,9 @@ \subsection{Null Shorting}
15607
15607
The semantics of the null aware member access operator \lit{?.}
15608
15608
is defined in terms of a program transformation known as
15609
15609
\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
15612
15613
(\ref{notation})
15613
15614
and equality comparisons with \NULL.
15614
15615
Null shorting is performed after the static analysis,
@@ -15618,8 +15619,8 @@ \subsection{Null Shorting}
15618
15619
\LMHash{}%
15619
15620
We use the phrase null-shorting as an adjective in order to
15620
15621
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'' %
15623
15624
}).
15624
15625
15625
15626
\commentary{%
@@ -15656,7 +15657,7 @@ \subsection{Null Shorting}
15656
15657
\IndexCustom{base-level}{null shorting!base-level}
15657
15658
to indicate that a term is Dart syntax,
15658
15659
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 .}
15660
15661
15661
15662
\LMHash{}%
15662
15663
\metaCode{fn[x:\,\,Exp]:\,\,Exp\,\,=>\,\,E}
@@ -15666,7 +15667,7 @@ \subsection{Null Shorting}
15666
15667
and
15667
15668
\metaCode{fn[k:\,\,Exp\,\,$\rightarrow$\,\,Exp]:\,\,Exp\,\,=>\,\,E}
15668
15669
defines a meta-level function of type
15669
- \metaCode{Exp\,\,$\rightarrow$\,\,Exp\,\,$\rightarrow$\,\,Exp}.
15670
+ \metaCode{( Exp\,\,$\rightarrow$\,\,Exp) \,\,$\rightarrow$\,\,Exp}.
15670
15671
Where obvious from context,
15671
15672
we elide the parameter and return types on the meta-level functions.
15672
15673
The meta-variables \metaCode{F} and \metaCode{G}
@@ -15675,12 +15676,11 @@ \subsection{Null Shorting}
15675
15676
is written as \metaCode{F[p]}.
15676
15677
15677
15678
\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$
15680
15680
into a meta-level function \metaCode{F} of type
15681
15681
\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$
15684
15684
with all occurrences of \metaCode{?.} eliminated
15685
15685
in favor of explicit sequencing using \LET{} expressions.
15686
15686
@@ -15692,27 +15692,31 @@ \subsection{Null Shorting}
15692
15692
15693
15693
\LMHash{}%
15694
15694
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$.
15701
15703
15702
15704
\LMHash{}%
15703
15705
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$})}}
15705
15708
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]}.
15709
15712
15710
15713
\LMHash{}%
15711
15714
We extend the expression translation to argument lists in the obvious way,
15712
15715
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}})}}
15714
15718
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}.
15716
15720
15717
15721
\LMHash{}%
15718
15722
We use three combinators to express the translation.
@@ -15745,7 +15749,7 @@ \subsection{Null Shorting}
15745
15749
bound to the result of evaluating the receiver,
15746
15750
produces the final expression.
15747
15751
The result is parameterized over the continuation of
15748
- the expression being translated.
15752
+ the expression being translated (\metaCode{k}) .
15749
15753
The continuation is only called in the case that
15750
15754
the result of evaluating the receiver is non-null.
15751
15755
@@ -15945,8 +15949,8 @@ \subsection{Null Shorting}
15945
15949
\commentary{%
15946
15950
\begin{itemize}
15947
15951
\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
15950
15954
\metaCode{TERM[\Base{[\,%
15951
15955
\Meta{EXP(\Base{$e_1$}), \ldots, EXP(\Base{$e_n$})}\,]}]}.
15952
15956
\item
0 commit comments