Skip to content

Commit 55a6f20

Browse files
committed
Small fixes in section Null Shorting
1 parent 55246d5 commit 55a6f20

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
@@ -16176,8 +16176,9 @@ \subsection{Null Shorting}
1617616176
The semantics of the null aware member access operator \lit{?.}
1617716177
is defined in terms of a program transformation known as
1617816178
\Index{null shorting}.
16179-
This program transformation eliminates all occurrences of \lit{?.}
16180-
by introducing \LET{} expressions
16179+
This program transformation transforms expressions
16180+
and leaves other program elements unchanged.
16181+
It eliminates all occurrences of \lit{?.} by introducing \LET{} expressions
1618116182
(\ref{notation})
1618216183
and equality comparisons with \NULL.
1618316184
Null shorting is performed after the static analysis,
@@ -16187,8 +16188,8 @@ \subsection{Null Shorting}
1618716188
\LMHash{}%
1618816189
We use the phrase null-shorting as an adjective in order to
1618916190
indicate the connections between null shorting and other concepts
16190-
(\commentary{
16191-
e.g., the null-shorting translation plays an important role in null shorting%
16191+
(\commentary{%
16192+
e.g., ``the null-shorting translation is used during null shorting''%
1619216193
}).
1619316194

1619416195
\commentary{%
@@ -16225,7 +16226,7 @@ \subsection{Null Shorting}
1622516226
\IndexCustom{base-level}{null shorting!base-level}
1622616227
to indicate that a term is Dart syntax,
1622716228
as opposed to meta-level syntax.
16228-
\commentary{For example, \code{x\,\,+\,\,1}.}
16229+
\commentary{For example, \code{x\,\,+\,\,1} is a base-level expression.}
1622916230

1623016231
\LMHash{}%
1623116232
\metaCode{fn[x:\,\,Exp]:\,\,Exp\,\,=>\,\,E}
@@ -16235,7 +16236,7 @@ \subsection{Null Shorting}
1623516236
and
1623616237
\metaCode{fn[k:\,\,Exp\,\,$\rightarrow$\,\,Exp]:\,\,Exp\,\,=>\,\,E}
1623716238
defines a meta-level function of type
16238-
\metaCode{Exp\,\,$\rightarrow$\,\,Exp\,\,$\rightarrow$\,\,Exp}.
16239+
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp}.
1623916240
Where obvious from context,
1624016241
we elide the parameter and return types on the meta-level functions.
1624116242
The meta-variables \metaCode{F} and \metaCode{G}
@@ -16244,12 +16245,11 @@ \subsection{Null Shorting}
1624416245
is written as \metaCode{F[p]}.
1624516246

1624616247
\LMHash{}%
16247-
Null shorting transforms an expression \metaCode{e}
16248-
(\commentary{whose meta-level type is \code{Exp}})
16248+
Null shorting transforms an expression $e$
1624916249
into a meta-level function \metaCode{F} of type
1625016250
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp},
16251-
which takes as an argument the continuation of \metaCode{e},
16252-
and produces an expression semantically equivalent to \metaCode{e}
16251+
which takes as an argument the continuation of $e$,
16252+
and produces an expression semantically equivalent to $e$
1625316253
with all occurrences of \metaCode{?.} eliminated
1625416254
in favor of explicit sequencing using \LET{} expressions.
1625516255

@@ -16261,27 +16261,31 @@ \subsection{Null Shorting}
1626116261

1626216262
\LMHash{}%
1626316263
The
16264-
\IndexCustom{expression translation}{null shorting!expression translation}
16265-
of an expression \metaCode{e} is
16266-
the result of applying the null-shorting translation
16267-
of \metaCode{e} to \metaCode{ID}.
16268-
That is, if \metaCode{e} translates to \metaCode{F},
16269-
then \metaCode{F[ID]} is the expression translation of \metaCode{e}.
16264+
\IndexCustom{null-shorting expression translation}{%
16265+
null shorting!expression translation}
16266+
of an expression $e$
16267+
(in this section abbreviated as the \NoIndex{expression translation} of $e$)
16268+
is the result of applying the null-shorting translation (defined below)
16269+
of $e$ to \metaCode{ID}.
16270+
That is, if $e$ translates to \metaCode{F},
16271+
then \metaCode{F[ID]} is the expression translation of $e$.
1627016272

1627116273
\LMHash{}%
1627216274
We use
16273-
\IndexCustom{\metaCode{EXP(e)}}{null shorting!\metaCode{EXP(e)}}
16275+
\IndexCustom{\metaCode{EXP(\textcolor{normativeColor}{$e$})}}{%
16276+
null shorting!\metaCode{EXP(\textcolor{normativeColor}{$e$})}}
1627416277
as a shorthand for
16275-
the expression translation of \metaCode{e}.
16276-
That is, if the null-shorting translation of \metaCode{e} is \metaCode{F},
16277-
then \metaCode{EXP(e)} is \metaCode{F[ID]}.
16278+
the expression translation of $e$.
16279+
That is, if the null-shorting translation of $e$ is \metaCode{F},
16280+
then \metaCode{EXP(\textcolor{normativeColor}{$e$})} is \metaCode{F[ID]}.
1627816281

1627916282
\LMHash{}%
1628016283
We extend the expression translation to argument lists in the obvious way,
1628116284
using
16282-
\IndexCustom{\metaCode{ARGS(args)}}{null shorting!\metaCode{ARGS(args)}}
16285+
\IndexCustom{\metaCode{ARGS(\textcolor{normativeColor}{\metavar{args}})}}{%
16286+
null shorting!\metaCode{ARGS(\textcolor{normativeColor}{\metavar{args}})}}
1628316287
to denote the result of applying the expression translation pointwise
16284-
to the arguments in the argument list \metaCode{args}.
16288+
to the arguments in the argument list \metavar{args}.
1628516289

1628616290
\LMHash{}%
1628716291
We use three combinators to express the translation.
@@ -16314,7 +16318,7 @@ \subsection{Null Shorting}
1631416318
bound to the result of evaluating the receiver,
1631516319
produces the final expression.
1631616320
The result is parameterized over the continuation of
16317-
the expression being translated.
16321+
the expression being translated (\metaCode{k}).
1631816322
The continuation is only called in the case that
1631916323
the result of evaluating the receiver is non-null.
1632016324

@@ -16514,8 +16518,8 @@ \subsection{Null Shorting}
1651416518
\commentary{%
1651516519
\begin{itemize}
1651616520
\item
16517-
A list literal \Base{\code{[\,$e_1$, \ldots, $e_n$\,]}}
16518-
translates to\\
16521+
A list literal \Base{\code{[\List{e}{1}{n}]}}
16522+
translates to
1651916523
\metaCode{TERM[\Base{[\,%
1652016524
\Meta{EXP(\Base{$e_1$}), \ldots, EXP(\Base{$e_n$})}\,]}]}.
1652116525
\item

0 commit comments

Comments
 (0)