Skip to content

Commit 3c8dea6

Browse files
committed
Small fixes in section Null Shorting
1 parent 23c5ec5 commit 3c8dea6

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
@@ -15858,8 +15858,9 @@ \subsection{Null Shorting}
1585815858
The semantics of the null aware member access operator \lit{?.}
1585915859
is defined in terms of a program transformation known as
1586015860
\Index{null shorting}.
15861-
This program transformation eliminates all occurrences of \lit{?.}
15862-
by introducing \LET{} expressions
15861+
This program transformation transforms expressions
15862+
and leaves other program elements unchanged.
15863+
It eliminates all occurrences of \lit{?.} by introducing \LET{} expressions
1586315864
(\ref{notation})
1586415865
and equality comparisons with \NULL.
1586515866
Null shorting is performed after the static analysis,
@@ -15869,8 +15870,8 @@ \subsection{Null Shorting}
1586915870
\LMHash{}%
1587015871
We use the phrase null-shorting as an adjective in order to
1587115872
indicate the connections between null shorting and other concepts
15872-
(\commentary{
15873-
e.g., the null-shorting translation plays an important role in null shorting%
15873+
(\commentary{%
15874+
e.g., ``the null-shorting translation is used during null shorting''%
1587415875
}).
1587515876

1587615877
\commentary{%
@@ -15907,7 +15908,7 @@ \subsection{Null Shorting}
1590715908
\IndexCustom{base-level}{null shorting!base-level}
1590815909
to indicate that a term is Dart syntax,
1590915910
as opposed to meta-level syntax.
15910-
\commentary{For example, \code{x\,\,+\,\,1}.}
15911+
\commentary{For example, \code{x\,\,+\,\,1} is a base-level expression.}
1591115912

1591215913
\LMHash{}%
1591315914
\metaCode{fn[x:\,\,Exp]:\,\,Exp\,\,=>\,\,E}
@@ -15917,7 +15918,7 @@ \subsection{Null Shorting}
1591715918
and
1591815919
\metaCode{fn[k:\,\,Exp\,\,$\rightarrow$\,\,Exp]:\,\,Exp\,\,=>\,\,E}
1591915920
defines a meta-level function of type
15920-
\metaCode{Exp\,\,$\rightarrow$\,\,Exp\,\,$\rightarrow$\,\,Exp}.
15921+
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp}.
1592115922
Where obvious from context,
1592215923
we elide the parameter and return types on the meta-level functions.
1592315924
The meta-variables \metaCode{F} and \metaCode{G}
@@ -15926,12 +15927,11 @@ \subsection{Null Shorting}
1592615927
is written as \metaCode{F[p]}.
1592715928

1592815929
\LMHash{}%
15929-
Null shorting transforms an expression \metaCode{e}
15930-
(\commentary{whose meta-level type is \code{Exp}})
15930+
Null shorting transforms an expression $e$
1593115931
into a meta-level function \metaCode{F} of type
1593215932
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp},
15933-
which takes as an argument the continuation of \metaCode{e},
15934-
and produces an expression semantically equivalent to \metaCode{e}
15933+
which takes as an argument the continuation of $e$,
15934+
and produces an expression semantically equivalent to $e$
1593515935
with all occurrences of \metaCode{?.} eliminated
1593615936
in favor of explicit sequencing using \LET{} expressions.
1593715937

@@ -15943,27 +15943,31 @@ \subsection{Null Shorting}
1594315943

1594415944
\LMHash{}%
1594515945
The
15946-
\IndexCustom{expression translation}{null shorting!expression translation}
15947-
of an expression \metaCode{e} is
15948-
the result of applying the null-shorting translation
15949-
of \metaCode{e} to \metaCode{ID}.
15950-
That is, if \metaCode{e} translates to \metaCode{F},
15951-
then \metaCode{F[ID]} is the expression translation of \metaCode{e}.
15946+
\IndexCustom{null-shorting expression translation}{%
15947+
null shorting!expression translation}
15948+
of an expression $e$
15949+
(in this section abbreviated as the \NoIndex{expression translation} of $e$)
15950+
is the result of applying the null-shorting translation (defined below)
15951+
of $e$ to \metaCode{ID}.
15952+
That is, if $e$ translates to \metaCode{F},
15953+
then \metaCode{F[ID]} is the expression translation of $e$.
1595215954

1595315955
\LMHash{}%
1595415956
We use
15955-
\IndexCustom{\metaCode{EXP(e)}}{null shorting!\metaCode{EXP(e)}}
15957+
\IndexCustom{\metaCode{EXP(\textcolor{normativeColor}{$e$})}}{%
15958+
null shorting!\metaCode{EXP(\textcolor{normativeColor}{$e$})}}
1595615959
as a shorthand for
15957-
the expression translation of \metaCode{e}.
15958-
That is, if the null-shorting translation of \metaCode{e} is \metaCode{F},
15959-
then \metaCode{EXP(e)} is \metaCode{F[ID]}.
15960+
the expression translation of $e$.
15961+
That is, if the null-shorting translation of $e$ is \metaCode{F},
15962+
then \metaCode{EXP(\textcolor{normativeColor}{$e$})} is \metaCode{F[ID]}.
1596015963

1596115964
\LMHash{}%
1596215965
We extend the expression translation to argument lists in the obvious way,
1596315966
using
15964-
\IndexCustom{\metaCode{ARGS(args)}}{null shorting!\metaCode{ARGS(args)}}
15967+
\IndexCustom{\metaCode{ARGS(\textcolor{normativeColor}{\metavar{args}})}}{%
15968+
null shorting!\metaCode{ARGS(\textcolor{normativeColor}{\metavar{args}})}}
1596515969
to denote the result of applying the expression translation pointwise
15966-
to the arguments in the argument list \metaCode{args}.
15970+
to the arguments in the argument list \metavar{args}.
1596715971

1596815972
\LMHash{}%
1596915973
We use three combinators to express the translation.
@@ -15996,7 +16000,7 @@ \subsection{Null Shorting}
1599616000
bound to the result of evaluating the receiver,
1599716001
produces the final expression.
1599816002
The result is parameterized over the continuation of
15999-
the expression being translated.
16003+
the expression being translated (\metaCode{k}).
1600016004
The continuation is only called in the case that
1600116005
the result of evaluating the receiver is non-null.
1600216006

@@ -16196,8 +16200,8 @@ \subsection{Null Shorting}
1619616200
\commentary{%
1619716201
\begin{itemize}
1619816202
\item
16199-
A list literal \Base{\code{[\,$e_1$, \ldots, $e_n$\,]}}
16200-
translates to\\
16203+
A list literal \Base{\code{[\List{e}{1}{n}]}}
16204+
translates to
1620116205
\metaCode{TERM[\Base{[\,%
1620216206
\Meta{EXP(\Base{$e_1$}), \ldots, EXP(\Base{$e_n$})}\,]}]}.
1620316207
\item

0 commit comments

Comments
 (0)