@@ -15679,8 +15679,9 @@ \subsection{Null Shorting}
15679
15679
The semantics of the null aware member access operator \lit{?.}
15680
15680
is defined in terms of a program transformation known as
15681
15681
\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
15684
15685
(\ref{notation})
15685
15686
and equality comparisons with \NULL.
15686
15687
Null shorting is performed after the static analysis,
@@ -15690,8 +15691,8 @@ \subsection{Null Shorting}
15690
15691
\LMHash{}%
15691
15692
We use the phrase null-shorting as an adjective in order to
15692
15693
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'' %
15695
15696
}).
15696
15697
15697
15698
\commentary{%
@@ -15728,7 +15729,7 @@ \subsection{Null Shorting}
15728
15729
\IndexCustom{base-level}{null shorting!base-level}
15729
15730
to indicate that a term is Dart syntax,
15730
15731
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 .}
15732
15733
15733
15734
\LMHash{}%
15734
15735
\metaCode{fn[x:\,\,Exp]:\,\,Exp\,\,=>\,\,E}
@@ -15738,7 +15739,7 @@ \subsection{Null Shorting}
15738
15739
and
15739
15740
\metaCode{fn[k:\,\,Exp\,\,$\rightarrow$\,\,Exp]:\,\,Exp\,\,=>\,\,E}
15740
15741
defines a meta-level function of type
15741
- \metaCode{Exp\,\,$\rightarrow$\,\,Exp\,\,$\rightarrow$\,\,Exp}.
15742
+ \metaCode{( Exp\,\,$\rightarrow$\,\,Exp) \,\,$\rightarrow$\,\,Exp}.
15742
15743
Where obvious from context,
15743
15744
we elide the parameter and return types on the meta-level functions.
15744
15745
The meta-variables \metaCode{F} and \metaCode{G}
@@ -15747,12 +15748,11 @@ \subsection{Null Shorting}
15747
15748
is written as \metaCode{F[p]}.
15748
15749
15749
15750
\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$
15752
15752
into a meta-level function \metaCode{F} of type
15753
15753
\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$
15756
15756
with all occurrences of \metaCode{?.} eliminated
15757
15757
in favor of explicit sequencing using \LET{} expressions.
15758
15758
@@ -15764,27 +15764,31 @@ \subsection{Null Shorting}
15764
15764
15765
15765
\LMHash{}%
15766
15766
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$.
15773
15775
15774
15776
\LMHash{}%
15775
15777
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$})}}
15777
15780
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]}.
15781
15784
15782
15785
\LMHash{}%
15783
15786
We extend the expression translation to argument lists in the obvious way,
15784
15787
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}})}}
15786
15790
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}.
15788
15792
15789
15793
\LMHash{}%
15790
15794
We use three combinators to express the translation.
@@ -15817,7 +15821,7 @@ \subsection{Null Shorting}
15817
15821
bound to the result of evaluating the receiver,
15818
15822
produces the final expression.
15819
15823
The result is parameterized over the continuation of
15820
- the expression being translated.
15824
+ the expression being translated (\metaCode{k}) .
15821
15825
The continuation is only called in the case that
15822
15826
the result of evaluating the receiver is non-null.
15823
15827
@@ -16017,8 +16021,8 @@ \subsection{Null Shorting}
16017
16021
\commentary{%
16018
16022
\begin{itemize}
16019
16023
\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
16022
16026
\metaCode{TERM[\Base{[\,%
16023
16027
\Meta{EXP(\Base{$e_1$}), \ldots, EXP(\Base{$e_n$})}\,]}]}.
16024
16028
\item
0 commit comments