|
68 | 68 | \def\WITH{\keyword{with}}
|
69 | 69 | \def\YIELD{\keyword{yield}}
|
70 | 70 |
|
| 71 | +% Used for inline code snippets. |
| 72 | +\newcommand{\code}[1]{\texttt{#1}} |
| 73 | + |
71 | 74 | % Used to specify syntactic sugar.
|
72 | 75 | \def\LET{\keyword{let}}
|
73 | 76 | \newcommand{\Let}[3]{\code{\LET\,\,{#1}\,=\,{#2}\ \IN\ {#3}}}
|
|
78 | 81 | \newcommand{\LetMany}[5]{%
|
79 | 82 | \code{\LET\,\,{#1}\,=\,{#2},\ $\cdots$,\ {#3}\,=\,{#4}\ \IN\ {#5}}}
|
80 | 83 |
|
81 |
| -% Used for inline code snippets. |
82 |
| -\def\code#1{\texttt{#1}} |
| 84 | +% Used for inline meta-code snippets |
| 85 | +\newcommand{\metaCode}[1]{{\color{metaColor}\texttt{#1}}} |
83 | 86 |
|
84 | 87 | % `call` has no special lexical status, so we just use \code{}.
|
85 | 88 | \def\CALL{\code{call}}
|
|
112 | 115 | \definecolor{normativeColor}{rgb}{0,0,0}
|
113 | 116 | \definecolor{commentaryColor}{rgb}{0.5,0.5,0.5}
|
114 | 117 | \definecolor{rationaleColor}{rgb}{0.5,0.5,0.5}
|
| 118 | +\definecolor{metaColor}{rgb}{0,0,1} |
115 | 119 |
|
116 | 120 | % Environments for different kinds of text.
|
117 | 121 | \newenvironment{Q}[1]{{\bf{}Upcoming: {#1}}}{}
|
118 | 122 | \newenvironment{rationale}[1]{{\color{rationaleColor}\it{#1}}}{}
|
119 | 123 | \newenvironment{commentary}[1]{{\color{commentaryColor}\sf{#1}}}{}
|
120 | 124 |
|
121 | 125 | % Auxiliary functions.
|
122 |
| -\newcommand{\flatten}[1]{\ensuremath{\mbox{\it flatten}({#1})}} |
123 |
| -\newcommand{\futureOrBase}[1]{\ensuremath{\mbox{\it futureOrBase}({#1})}} |
124 |
| -\newcommand{\overrides}[1]{\ensuremath{\mbox{\it overrides}({#1})}} |
125 |
| -\newcommand{\inherited}[1]{\ensuremath{\mbox{\it inherited}({#1})}} |
| 126 | +\newcommand{\flatten}[1]{\ensuremath{\metavar{flatten}({#1})}} |
| 127 | +\newcommand{\futureOrBase}[1]{\ensuremath{\metavar{futureOrBase}({#1})}} |
| 128 | +\newcommand{\overrides}[1]{\ensuremath{\metavar{overrides}({#1})}} |
| 129 | +\newcommand{\inherited}[1]{\ensuremath{\metavar{inherited}({#1})}} |
126 | 130 |
|
127 | 131 | % Used as a mini-section marker, indicating visibly that a range of
|
128 | 132 | % text (usually just a couple of paragraphs) are concerned with one
|
|
131 | 135 | \newcommand{\Case}[1]{\textbf{Case }$\langle\hspace{0.1em}${#1}$\hspace{0.1em}\rangle$\textbf{.}}
|
132 | 136 | \newcommand{\EndCase}{\mbox{}\hfill$\scriptscriptstyle\Box$\xspace}
|
133 | 137 |
|
134 |
| -\newenvironment{dartCode}[1][!ht] {% |
| 138 | +\newenvironment{dartCode}[1][!ht]{% |
135 | 139 | \def\@programcr{\@addfield\strut}%
|
136 | 140 | \let\\=\@programcr%
|
137 | 141 | \relax\@vobeyspaces\obeylines%
|
138 | 142 | \ttfamily\color{commentaryColor}%
|
139 | 143 | \vspace{1em}%
|
140 | 144 | }{\normalcolor\vspace{1em}}
|
141 | 145 |
|
142 |
| -\newenvironment{normativeDartCode}[1][!ht] {% |
| 146 | +\newenvironment{normativeDartCode}[1][!ht]{% |
143 | 147 | \def\@programcr{\@addfield\strut}%
|
144 | 148 | \let\\=\@programcr%
|
145 | 149 | \relax\@vobeyspaces\obeylines%
|
146 | 150 | \ttfamily\color{normativeColor}%
|
147 | 151 | \vspace{1em}%
|
148 | 152 | }{\normalcolor\vspace{1em}}
|
149 | 153 |
|
| 154 | +\newenvironment{metaLevelCode}[1][!ht]{% |
| 155 | + \def\@programcr{\@addfield\strut}% |
| 156 | + \let\\=\@programcr% |
| 157 | + \relax\@vobeyspaces\obeylines% |
| 158 | + \ttfamily\color{metaColor}% |
| 159 | + \vspace{1em}% |
| 160 | +}{\normalcolor\vspace{1em}} |
| 161 | + |
150 | 162 | % Used for comments in a code context.
|
151 | 163 | \def\comment#1{\textsf{#1}}
|
152 | 164 |
|
|
156 | 168 |
|
157 | 169 | % Used for defining occurrence of phrase, with customized index entry.
|
158 | 170 | \newcommand{\IndexCustom}[2]{%
|
159 |
| - \leavevmode\marginpar{\ensuremath{\diamond}}\emph{#1}\index{#2}} |
| 171 | + \leavevmode\marginpar{\ensuremath{_{^\vartriangle}}}\emph{#1}\index{#2}} |
160 | 172 |
|
161 | 173 | % Used for the defining occurrence of a local symbol.
|
162 | 174 | \newcommand{\DefineSymbol}[1]{%
|
|
177 | 189 |
|
178 | 190 | % Same appearance, but not adding an entry to the index.
|
179 | 191 | \newcommand{\NoIndex}[1]{%
|
180 |
| - \leavevmode\marginpar{\quad\ensuremath{\diamond}}\emph{#1}} |
| 192 | + \leavevmode\marginpar{\ensuremath{_{^\vartriangle}}}\emph{#1}} |
| 193 | + |
| 194 | +% Mark a compile-time error in the margin. |
| 195 | +\newcommand{\Error}[1]{% |
| 196 | + \leavevmode\marginpar{\ensuremath{_{^\ominus}}}{#1}} |
181 | 197 |
|
182 | 198 | % Used to specify comma separated lists of similar symbols.
|
183 | 199 | \newcommand{\List}[3]{\ensuremath{{#1}_{#2},\,\ldots,\ {#1}_{#3}}}
|
|
189 | 205 | \newcommand{\PairList}[4]{\ensuremath{%
|
190 | 206 | {#1}_{#3}\ {#2}_{#3},\,\ldots,\ {#1}_{#4}\ {#2}_{#4}}}
|
191 | 207 |
|
| 208 | +% Used to specify named arguments. |
| 209 | +% Parameters: Parameter name, argument name, index at start, index at end. |
| 210 | +\newcommand{\NamedArgumentList}[4]{\PairList{#1}{\!\!:\,\,{#2}}{#3}{#4}} |
| 211 | + |
| 212 | +% Used to specify an argument list including positional and named arguments. |
| 213 | +% Parameters: Argument name, number of positional arguments, named parameter |
| 214 | +% name, number of named arguments. |
| 215 | +\newcommand{\ArgumentList}[4]{% |
| 216 | + \List{#1}{1}{#2},\ \NamedArgumentList{#3}{#1}{{#2}+1}{{#2}+{#4}}} |
| 217 | + |
| 218 | +% Used to specify a standard argument list. |
| 219 | +\newcommand{\ArgumentListStd}{\ArgumentList{a}{n}{x}{k}} |
| 220 | + |
| 221 | +% Used to specify a standard type argument list. |
| 222 | +\newcommand{\TypeArgumentListStd}{\List{A}{1}{r}} |
| 223 | + |
192 | 224 | % Used to specify a list of tuples of the form $(K_j, V_j)$ which are
|
193 | 225 | % used with collection literals.
|
194 | 226 | \newcommand{\KeyValueTypeList}[4]{\ensuremath{%
|
|
278 | 310 |
|
279 | 311 | % Used to specify function type parameter lists with named optionals.
|
280 | 312 | % Arguments: Parameter type, number of required parameters,
|
281 |
| -% name of optional parameters, number of optional parameters. |
282 |
| -\newcommand{\FunctionTypeNamedArguments}[4]{% |
283 |
| - \List{#1}{1}{#2},\ \{\PairList{#1}{#3}{{#2}+1}{{#2}+{#4}}\}} |
| 313 | +% name of optional parameters, number of optional parameters, |
| 314 | +% name of `required` symbol. |
| 315 | +\newcommand{\FunctionTypeNamedArguments}[5]{% |
| 316 | + \List{#1}{1}{#2},\ \{\TripleList{#5}{#1}{#3}{{#2}+1}{{#2}+{#4}}\}} |
284 | 317 |
|
285 | 318 | \newcommand{\FunctionTypeNamedArgumentsStd}{%
|
286 |
| - \FunctionTypeNamedArguments{T}{n}{x}{k}} |
| 319 | + \FunctionTypeNamedArguments{T}{n}{x}{k}{r}} |
287 | 320 |
|
288 | 321 | % Used to specify function types with named parameters:
|
289 | 322 | % Arguments: Return type, spacer, type parameter name, bound name,
|
290 | 323 | % number of type parameters, parameter type, number of required parameters,
|
291 |
| -% name of optional parameters, number of optional parameters. |
| 324 | +% name of optional parameters, number of optional parameters, |
| 325 | +% name of `required` symbol. |
292 | 326 | \newcommand{\FunctionTypeNamed}[9]{%
|
293 |
| - \FunctionType{#1}{#2}{#3}{#4}{#5}{% |
294 |
| - \FunctionTypeNamedArguments{#6}{#7}{#8}{#9}}} |
| 327 | + \FunctionType{#1}{#2}{#3}{#4}{#5}{\\ |
| 328 | + \mbox{}\qquad\FunctionTypeNamedArguments{#6}{#7}{#8}{#9}{#10}}} |
295 | 329 |
|
296 | 330 | % Same as \FunctionType except suitable for inline usage, hence omitting
|
297 | 331 | % the spacer argument.
|
298 |
| -\newcommand{\RawFunctionTypeNamed}[8]{% |
| 332 | +\newcommand{\RawFunctionTypeNamed}[9]{% |
299 | 333 | \RawFunctionType{#1}{#2}{#3}{#4}{%
|
300 |
| - \FunctionTypeNamedArguments{#5}{#6}{#7}{#8}}} |
| 334 | + \FunctionTypeNamedArguments{#5}{#6}{#7}{#8}{#9}}} |
301 | 335 |
|
302 | 336 | % Used to specify function types with no optional parameters:
|
303 | 337 | % Arguments: Return type, spacer, type parameter name, bound name,
|
|
313 | 347 | \RawFunctionTypePositional{#1}{X}{B}{s}{T}{n}{k}}
|
314 | 348 |
|
315 | 349 | \newcommand{\FunctionTypeNamedStd}[1]{%
|
316 |
| - \FunctionTypeNamed{#1}{ }{X}{B}{s}{T}{n}{x}{k}} |
| 350 | + \FunctionTypeNamed{#1}{ }{X}{B}{s}{T}{n}{x}{k}{r}} |
317 | 351 |
|
318 | 352 | \newcommand{\RawFunctionTypeNamedStd}[1]{%
|
319 |
| - \RawFunctionTypeNamed{#1}{X}{B}{s}{T}{n}{x}{k}} |
| 353 | + \RawFunctionTypeNamed{#1}{X}{B}{s}{T}{n}{x}{k}{r}} |
320 | 354 |
|
321 | 355 | \newcommand{\FunctionTypeAllRequiredStd}[1]{%
|
322 | 356 | \FunctionTypeAllRequired{#1}{ }{X}{B}{s}{T}{n}}
|
|
325 | 359 | \FunctionTypePositional{#1}{\\}{X}{B}{s}{T}{n}{k}}
|
326 | 360 |
|
327 | 361 | \newcommand{\FunctionTypeNamedStdCr}[1]{%
|
328 |
| - \FunctionTypeNamed{#1}{\\}{X}{B}{s}{T}{n}{x}{k}} |
| 362 | + \FunctionTypeNamed{#1}{\\}{X}{B}{s}{T}{n}{x}{k}{r}} |
| 363 | + |
| 364 | +\newcommand{\FunctionTypeNamedStdArgCr}[1]{% |
| 365 | + \FunctionTypeNamedArgCr{#1}{ }{X}{B}{s}{T}{n}{x}{k}{r}} |
329 | 366 |
|
330 | 367 | \newcommand{\FunctionTypeAllRequiredStdCr}[1]{%
|
331 | 368 | \FunctionTypeAllRequired{#1}{\\}{X}{B}{s}{T}{n}}
|
|
341 | 378 |
|
342 | 379 | % Judgment expressing that a subtype relation exists.
|
343 | 380 | \newcommand{\Subtype}[3]{\ensuremath{{#1}\vdash{#2}\,<:\,{#3}}}
|
344 |
| -\newcommand{\SubtypeStd}[2]{\Subtype{\Gamma}{#1}{#2}} |
| 381 | +\newcommand{\SubtypeStd}[2]{\Subtype{\Delta}{#1}{#2}} |
345 | 382 | % Subtype judgment where the environment is omitted (NE: "no environment").
|
346 | 383 | \newcommand{\SubtypeNE}[2]{\ensuremath{{#1}\,<:\,{#2}}}
|
347 | 384 |
|
348 | 385 | % Judgment expressing that a supertype relation exists.
|
349 | 386 | \newcommand{\Supertype}[3]{\ensuremath{{#1}\vdash{#2}\,:>\,{#3}}}
|
350 |
| -\newcommand{\SupertypeStd}[2]{\Supertype{\Gamma}{#1}{#2}} |
| 387 | +\newcommand{\SupertypeStd}[2]{\Supertype{\Delta}{#1}{#2}} |
351 | 388 |
|
352 | 389 | % Judgment expressing that an assignability relation exists.
|
353 | 390 | \newcommand{\AssignableRelationSymbol}{\ensuremath{\Longleftrightarrow}}
|
|
387 | 424 | \newcommand{\EvaluateElementName}{\metavar{evaluateElement}}
|
388 | 425 | \newcommand{\EvaluateElement}[1]{\ensuremath{\EvaluateElementName({#1})}}
|
389 | 426 |
|
| 427 | +\newcommand{\FlattenName}{\metavar{flatten}} |
| 428 | +\newcommand{\Flatten}[1]{\ensuremath{\FlattenName(\code{#1})}} |
| 429 | + |
| 430 | +\newcommand{\NominalTypeDepthName}{\metavar{nominalTypeDepth}} |
| 431 | +\newcommand{\NominalTypeDepth}[1]{% |
| 432 | + \ensuremath{\NominalTypeDepthName(\code{#1})}} |
| 433 | + |
| 434 | +\newcommand{\TopMergeTypeName}{\metavar{topMergeType}} |
| 435 | +\newcommand{\TopMergeType}[2]{% |
| 436 | + \ensuremath{\TopMergeTypeName(\code{{#1},\,\,{#2}})}} |
| 437 | + |
| 438 | +\newcommand{\NonNullTypeName}{\metavar{nonNullType}} |
| 439 | +\newcommand{\NonNullType}[1]{\ensuremath{\NonNullTypeName(\code{#1})}} |
| 440 | + |
| 441 | +\newcommand{\IsTopTypeName}{\metavar{isTopType}} |
| 442 | +\newcommand{\IsTopType}[1]{\ensuremath{\IsTopTypeName(\code{#1})}} |
| 443 | + |
| 444 | +\newcommand{\IsObjectTypeName}{\metavar{isObjectType}} |
| 445 | +\newcommand{\IsObjectType}[1]{\ensuremath{\IsObjectTypeName(\code{#1})}} |
| 446 | + |
| 447 | +\newcommand{\IsBottomTypeName}{\metavar{isBottomType}} |
| 448 | +\newcommand{\IsBottomType}[1]{\ensuremath{\IsBottomTypeName(\code{#1})}} |
| 449 | + |
| 450 | +\newcommand{\IsNullTypeName}{\metavar{isNullType}} |
| 451 | +\newcommand{\IsNullType}[1]{\ensuremath{\IsNullTypeName(\code{#1})}} |
| 452 | + |
| 453 | +\newcommand{\IsMoreTopTypeName}{\metavar{isMoreTopType}} |
| 454 | +\newcommand{\IsMoreTopType}[2]{% |
| 455 | + \ensuremath{\IsMoreTopTypeName(\code{{#1},\,\,{#2}})}} |
| 456 | + |
| 457 | +\newcommand{\IsMoreBottomTypeName}{\metavar{isMoreBottomType}} |
| 458 | +\newcommand{\IsMoreBottomType}[2]{% |
| 459 | + \ensuremath{\IsMoreBottomTypeName(\code{{#1},\,\,{#2}})}} |
| 460 | + |
| 461 | +\newcommand{\NormalizedTypeOfName}{\metavar{normalizedType}} |
| 462 | +\newcommand{\NormalizedTypeOf}[1]{% |
| 463 | + \ensuremath{\NormalizedTypeOfName(\code{#1})}} |
| 464 | + |
| 465 | +\newcommand{\FutureValueTypeOfName}{\metavar{futureValueType}} |
| 466 | +\newcommand{\FutureValueTypeOf}[1]{% |
| 467 | + \ensuremath{\FutureValueTypeOfName(\code{#1})}} |
| 468 | + |
| 469 | +\newcommand{\UpperBoundTypeName}{\metavar{standardUpperBound}} |
| 470 | +\newcommand{\UpperBoundType}[2]{% |
| 471 | + \ensuremath{\UpperBoundTypeName(\code{{#1},\,\,{#2}})}} |
| 472 | + |
| 473 | +\newcommand{\LowerBoundTypeName}{\metavar{standardLowerBound}} |
| 474 | +\newcommand{\LowerBoundType}[2]{% |
| 475 | + \ensuremath{\LowerBoundTypeName(\code{{#1},\,\,{#2}})}} |
| 476 | + |
| 477 | +\newcommand{\DefEquals}[2]{\ensuremath{{#1}\stackrel{\vartriangle}{=}{#2}}} |
| 478 | +\newcommand{\DefEqualsNewline}[2]{ |
| 479 | + \ensuremath{{#1}\stackrel{\vartriangle}{=}}\\ |
| 480 | + \ensuremath{{#2}}% |
| 481 | +} |
| 482 | + |
390 | 483 | % ----------------------------------------------------------------------
|
391 | 484 | % Support for hash valued Location Markers
|
392 | 485 |
|
|
0 commit comments