Skip to content

Commit 4ae7798

Browse files
committed
Small fixes in section Null Shorting
1 parent 62f8edb commit 4ae7798

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
@@ -15838,8 +15838,9 @@ \subsection{Null Shorting}
1583815838
The semantics of the null aware member access operator \lit{?.}
1583915839
is defined in terms of a program transformation known as
1584015840
\Index{null shorting}.
15841-
This program transformation eliminates all occurrences of \lit{?.}
15842-
by introducing \LET{} expressions
15841+
This program transformation transforms expressions
15842+
and leaves other program elements unchanged.
15843+
It eliminates all occurrences of \lit{?.} by introducing \LET{} expressions
1584315844
(\ref{notation})
1584415845
and equality comparisons with \NULL.
1584515846
Null shorting is performed after the static analysis,
@@ -15849,8 +15850,8 @@ \subsection{Null Shorting}
1584915850
\LMHash{}%
1585015851
We use the phrase null-shorting as an adjective in order to
1585115852
indicate the connections between null shorting and other concepts
15852-
(\commentary{
15853-
e.g., the null-shorting translation plays an important role in null shorting%
15853+
(\commentary{%
15854+
e.g., ``the null-shorting translation is used during null shorting''%
1585415855
}).
1585515856

1585615857
\commentary{%
@@ -15887,7 +15888,7 @@ \subsection{Null Shorting}
1588715888
\IndexCustom{base-level}{null shorting!base-level}
1588815889
to indicate that a term is Dart syntax,
1588915890
as opposed to meta-level syntax.
15890-
\commentary{For example, \code{x\,\,+\,\,1}.}
15891+
\commentary{For example, \code{x\,\,+\,\,1} is a base-level expression.}
1589115892

1589215893
\LMHash{}%
1589315894
\metaCode{fn[x:\,\,Exp]:\,\,Exp\,\,=>\,\,E}
@@ -15897,7 +15898,7 @@ \subsection{Null Shorting}
1589715898
and
1589815899
\metaCode{fn[k:\,\,Exp\,\,$\rightarrow$\,\,Exp]:\,\,Exp\,\,=>\,\,E}
1589915900
defines a meta-level function of type
15900-
\metaCode{Exp\,\,$\rightarrow$\,\,Exp\,\,$\rightarrow$\,\,Exp}.
15901+
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp}.
1590115902
Where obvious from context,
1590215903
we elide the parameter and return types on the meta-level functions.
1590315904
The meta-variables \metaCode{F} and \metaCode{G}
@@ -15906,12 +15907,11 @@ \subsection{Null Shorting}
1590615907
is written as \metaCode{F[p]}.
1590715908

1590815909
\LMHash{}%
15909-
Null shorting transforms an expression \metaCode{e}
15910-
(\commentary{whose meta-level type is \code{Exp}})
15910+
Null shorting transforms an expression $e$
1591115911
into a meta-level function \metaCode{F} of type
1591215912
\metaCode{(Exp\,\,$\rightarrow$\,\,Exp)\,\,$\rightarrow$\,\,Exp},
15913-
which takes as an argument the continuation of \metaCode{e},
15914-
and produces an expression semantically equivalent to \metaCode{e}
15913+
which takes as an argument the continuation of $e$,
15914+
and produces an expression semantically equivalent to $e$
1591515915
with all occurrences of \metaCode{?.} eliminated
1591615916
in favor of explicit sequencing using \LET{} expressions.
1591715917

@@ -15923,27 +15923,31 @@ \subsection{Null Shorting}
1592315923

1592415924
\LMHash{}%
1592515925
The
15926-
\IndexCustom{expression translation}{null shorting!expression translation}
15927-
of an expression \metaCode{e} is
15928-
the result of applying the null-shorting translation
15929-
of \metaCode{e} to \metaCode{ID}.
15930-
That is, if \metaCode{e} translates to \metaCode{F},
15931-
then \metaCode{F[ID]} is the expression translation of \metaCode{e}.
15926+
\IndexCustom{null-shorting expression translation}{%
15927+
null shorting!expression translation}
15928+
of an expression $e$
15929+
(in this section abbreviated as the \NoIndex{expression translation} of $e$)
15930+
is the result of applying the null-shorting translation (defined below)
15931+
of $e$ to \metaCode{ID}.
15932+
That is, if $e$ translates to \metaCode{F},
15933+
then \metaCode{F[ID]} is the expression translation of $e$.
1593215934

1593315935
\LMHash{}%
1593415936
We use
15935-
\IndexCustom{\metaCode{EXP(e)}}{null shorting!\metaCode{EXP(e)}}
15937+
\IndexCustom{\metaCode{EXP(\textcolor{normativeColor}{$e$})}}{%
15938+
null shorting!\metaCode{EXP(\textcolor{normativeColor}{$e$})}}
1593615939
as a shorthand for
15937-
the expression translation of \metaCode{e}.
15938-
That is, if the null-shorting translation of \metaCode{e} is \metaCode{F},
15939-
then \metaCode{EXP(e)} is \metaCode{F[ID]}.
15940+
the expression translation of $e$.
15941+
That is, if the null-shorting translation of $e$ is \metaCode{F},
15942+
then \metaCode{EXP(\textcolor{normativeColor}{$e$})} is \metaCode{F[ID]}.
1594015943

1594115944
\LMHash{}%
1594215945
We extend the expression translation to argument lists in the obvious way,
1594315946
using
15944-
\IndexCustom{\metaCode{ARGS(args)}}{null shorting!\metaCode{ARGS(args)}}
15947+
\IndexCustom{\metaCode{ARGS(\textcolor{normativeColor}{\metavar{args}})}}{%
15948+
null shorting!\metaCode{ARGS(\textcolor{normativeColor}{\metavar{args}})}}
1594515949
to denote the result of applying the expression translation pointwise
15946-
to the arguments in the argument list \metaCode{args}.
15950+
to the arguments in the argument list \metavar{args}.
1594715951

1594815952
\LMHash{}%
1594915953
We use three combinators to express the translation.
@@ -15976,7 +15980,7 @@ \subsection{Null Shorting}
1597615980
bound to the result of evaluating the receiver,
1597715981
produces the final expression.
1597815982
The result is parameterized over the continuation of
15979-
the expression being translated.
15983+
the expression being translated (\metaCode{k}).
1598015984
The continuation is only called in the case that
1598115985
the result of evaluating the receiver is non-null.
1598215986

@@ -16176,8 +16180,8 @@ \subsection{Null Shorting}
1617616180
\commentary{%
1617716181
\begin{itemize}
1617816182
\item
16179-
A list literal \Base{\code{[\,$e_1$, \ldots, $e_n$\,]}}
16180-
translates to\\
16183+
A list literal \Base{\code{[\List{e}{1}{n}]}}
16184+
translates to
1618116185
\metaCode{TERM[\Base{[\,%
1618216186
\Meta{EXP(\Base{$e_1$}), \ldots, EXP(\Base{$e_n$})}\,]}]}.
1618316187
\item

0 commit comments

Comments
 (0)