|
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}}}{}
|
|
132 | 136 | \newcommand{\Case}[1]{\textbf{Case }$\langle\hspace{0.1em}${#1}$\hspace{0.1em}\rangle$\textbf{.}}
|
133 | 137 | \newcommand{\EndCase}{\mbox{}\hfill$\scriptscriptstyle\Box$\xspace}
|
134 | 138 |
|
135 |
| -\newenvironment{dartCode}[1][!ht] {% |
| 139 | +\newenvironment{dartCode}[1][!ht]{% |
136 | 140 | \def\@programcr{\@addfield\strut}%
|
137 | 141 | \let\\=\@programcr%
|
138 | 142 | \relax\@vobeyspaces\obeylines%
|
139 | 143 | \ttfamily\color{commentaryColor}%
|
140 | 144 | \vspace{1em}%
|
141 | 145 | }{\normalcolor\vspace{1em}}
|
142 | 146 |
|
143 |
| -\newenvironment{normativeDartCode}[1][!ht] {% |
| 147 | +\newenvironment{normativeDartCode}[1][!ht]{% |
144 | 148 | \def\@programcr{\@addfield\strut}%
|
145 | 149 | \let\\=\@programcr%
|
146 | 150 | \relax\@vobeyspaces\obeylines%
|
147 | 151 | \ttfamily\color{normativeColor}%
|
148 | 152 | \vspace{1em}%
|
149 | 153 | }{\normalcolor\vspace{1em}}
|
150 | 154 |
|
| 155 | +\newenvironment{metaLevelCode}[1][!ht]{% |
| 156 | + \def\@programcr{\@addfield\strut}% |
| 157 | + \let\\=\@programcr% |
| 158 | + \relax\@vobeyspaces\obeylines% |
| 159 | + \ttfamily\color{metaColor}% |
| 160 | + \vspace{1em}% |
| 161 | +}{\normalcolor\vspace{1em}} |
| 162 | + |
151 | 163 | % Used for comments in a code context.
|
152 | 164 | \def\comment#1{\textsf{#1}}
|
153 | 165 |
|
|
157 | 169 |
|
158 | 170 | % Used for defining occurrence of phrase, with customized index entry.
|
159 | 171 | \newcommand{\IndexCustom}[2]{%
|
160 |
| - \leavevmode\marginpar{\ensuremath{\diamond}}\emph{#1}\index{#2}} |
| 172 | + \leavevmode\marginpar{\ensuremath{_{^\vartriangle}}}\emph{#1}\index{#2}} |
161 | 173 |
|
162 | 174 | % Used for the defining occurrence of a local symbol.
|
163 | 175 | \newcommand{\DefineSymbol}[1]{%
|
|
178 | 190 |
|
179 | 191 | % Same appearance, but not adding an entry to the index.
|
180 | 192 | \newcommand{\NoIndex}[1]{%
|
181 |
| - \leavevmode\marginpar{\quad\ensuremath{\diamond}}\emph{#1}} |
| 193 | + \leavevmode\marginpar{\ensuremath{_{^\vartriangle}}}\emph{#1}} |
| 194 | + |
| 195 | +% Mark a compile-time error in the margin. |
| 196 | +\newcommand{\Error}[1]{% |
| 197 | + \leavevmode\marginpar{\ensuremath{_{^\ominus}}}{#1}} |
182 | 198 |
|
183 | 199 | % Used to specify comma separated lists of similar symbols.
|
184 | 200 | \newcommand{\List}[3]{\ensuremath{{#1}_{#2},\,\ldots,\ {#1}_{#3}}}
|
|
190 | 206 | \newcommand{\PairList}[4]{\ensuremath{%
|
191 | 207 | {#1}_{#3}\ {#2}_{#3},\,\ldots,\ {#1}_{#4}\ {#2}_{#4}}}
|
192 | 208 |
|
| 209 | +% Used to specify named arguments. |
| 210 | +% Parameters: Parameter name, argument name, index at start, index at end. |
| 211 | +\newcommand{\NamedArgumentList}[4]{\PairList{#1}{\!\!:\,\,{#2}}{#3}{#4}} |
| 212 | + |
| 213 | +% Used to specify an argument list including positional and named arguments. |
| 214 | +% Parameters: Argument name, number of positional arguments, named parameter |
| 215 | +% name, number of named arguments. |
| 216 | +\newcommand{\ArgumentList}[4]{% |
| 217 | + \List{#1}{1}{#2},\ \NamedArgumentList{#3}{#1}{{#2}+1}{{#2}+{#4}}} |
| 218 | + |
| 219 | +% Used to specify a standard argument list. |
| 220 | +\newcommand{\ArgumentListStd}{\ArgumentList{a}{n}{x}{k}} |
| 221 | + |
| 222 | +% Used to specify a standard type argument list. |
| 223 | +\newcommand{\TypeArgumentListStd}{\List{A}{1}{r}} |
| 224 | + |
193 | 225 | % Used to specify a list of tuples of the form $(K_j, V_j)$ which are
|
194 | 226 | % used with collection literals.
|
195 | 227 | \newcommand{\KeyValueTypeList}[4]{\ensuremath{%
|
|
279 | 311 |
|
280 | 312 | % Used to specify function type parameter lists with named optionals.
|
281 | 313 | % Arguments: Parameter type, number of required parameters,
|
282 |
| -% name of optional parameters, number of optional parameters. |
283 |
| -\newcommand{\FunctionTypeNamedArguments}[4]{% |
284 |
| - \List{#1}{1}{#2},\ \{\PairList{#1}{#3}{{#2}+1}{{#2}+{#4}}\}} |
285 |
| - |
| 314 | +% name of optional parameters, number of optional parameters, |
| 315 | +% name of `required` symbol. |
| 316 | +\newcommand{\FunctionTypeNamedArguments}[5]{% |
| 317 | + \List{#1}{1}{#2},\ \{\TripleList{#5}{#1}{#3}{{#2}+1}{{#2}+{#4}}\}} |
| 318 | + |
286 | 319 | \newcommand{\FunctionTypeNamedArgumentsStd}{%
|
287 |
| - \FunctionTypeNamedArguments{T}{n}{x}{k}} |
| 320 | + \FunctionTypeNamedArguments{T}{n}{x}{k}{r}} |
288 | 321 |
|
289 | 322 | % Used to specify function types with named parameters:
|
290 | 323 | % Arguments: Return type, spacer, type parameter name, bound name,
|
291 | 324 | % number of type parameters, parameter type, number of required parameters,
|
292 |
| -% name of optional parameters, number of optional parameters. |
| 325 | +% name of optional parameters, number of optional parameters, |
| 326 | +% name of `required` symbol. |
293 | 327 | \newcommand{\FunctionTypeNamed}[9]{%
|
294 |
| - \FunctionType{#1}{#2}{#3}{#4}{#5}{% |
295 |
| - \FunctionTypeNamedArguments{#6}{#7}{#8}{#9}}} |
| 328 | + \FunctionType{#1}{#2}{#3}{#4}{#5}{\\ |
| 329 | + \mbox{}\qquad\FunctionTypeNamedArguments{#6}{#7}{#8}{#9}{#10}}} |
296 | 330 |
|
297 | 331 | % Same as \FunctionType except suitable for inline usage, hence omitting
|
298 | 332 | % the spacer argument.
|
299 |
| -\newcommand{\RawFunctionTypeNamed}[8]{% |
| 333 | +\newcommand{\RawFunctionTypeNamed}[9]{% |
300 | 334 | \RawFunctionType{#1}{#2}{#3}{#4}{%
|
301 |
| - \FunctionTypeNamedArguments{#5}{#6}{#7}{#8}}} |
| 335 | + \FunctionTypeNamedArguments{#5}{#6}{#7}{#8}{#9}}} |
302 | 336 |
|
303 | 337 | % Used to specify function types with no optional parameters:
|
304 | 338 | % Arguments: Return type, spacer, type parameter name, bound name,
|
|
314 | 348 | \RawFunctionTypePositional{#1}{X}{B}{s}{T}{n}{k}}
|
315 | 349 |
|
316 | 350 | \newcommand{\FunctionTypeNamedStd}[1]{%
|
317 |
| - \FunctionTypeNamed{#1}{ }{X}{B}{s}{T}{n}{x}{k}} |
| 351 | + \FunctionTypeNamed{#1}{ }{X}{B}{s}{T}{n}{x}{k}{r}} |
318 | 352 |
|
319 | 353 | \newcommand{\RawFunctionTypeNamedStd}[1]{%
|
320 |
| - \RawFunctionTypeNamed{#1}{X}{B}{s}{T}{n}{x}{k}} |
| 354 | + \RawFunctionTypeNamed{#1}{X}{B}{s}{T}{n}{x}{k}{r}} |
321 | 355 |
|
322 | 356 | \newcommand{\FunctionTypeAllRequiredStd}[1]{%
|
323 | 357 | \FunctionTypeAllRequired{#1}{ }{X}{B}{s}{T}{n}}
|
|
326 | 360 | \FunctionTypePositional{#1}{\\}{X}{B}{s}{T}{n}{k}}
|
327 | 361 |
|
328 | 362 | \newcommand{\FunctionTypeNamedStdCr}[1]{%
|
329 |
| - \FunctionTypeNamed{#1}{\\}{X}{B}{s}{T}{n}{x}{k}} |
| 363 | + \FunctionTypeNamed{#1}{\\}{X}{B}{s}{T}{n}{x}{k}{r}} |
| 364 | + |
| 365 | +\newcommand{\FunctionTypeNamedStdArgCr}[1]{% |
| 366 | + \FunctionTypeNamedArgCr{#1}{ }{X}{B}{s}{T}{n}{x}{k}{r}} |
330 | 367 |
|
331 | 368 | \newcommand{\FunctionTypeAllRequiredStdCr}[1]{%
|
332 | 369 | \FunctionTypeAllRequired{#1}{\\}{X}{B}{s}{T}{n}}
|
|
342 | 379 |
|
343 | 380 | % Judgment expressing that a subtype relation exists.
|
344 | 381 | \newcommand{\Subtype}[3]{\ensuremath{{#1}\vdash{#2}\,<:\,{#3}}}
|
345 |
| -\newcommand{\SubtypeStd}[2]{\Subtype{\Gamma}{#1}{#2}} |
| 382 | +\newcommand{\SubtypeStd}[2]{\Subtype{\Delta}{#1}{#2}} |
346 | 383 | % Subtype judgment where the environment is omitted (NE: "no environment").
|
347 | 384 | \newcommand{\SubtypeNE}[2]{\ensuremath{{#1}\,<:\,{#2}}}
|
348 | 385 |
|
349 | 386 | % Judgment expressing that a supertype relation exists.
|
350 | 387 | \newcommand{\Supertype}[3]{\ensuremath{{#1}\vdash{#2}\,:>\,{#3}}}
|
351 |
| -\newcommand{\SupertypeStd}[2]{\Supertype{\Gamma}{#1}{#2}} |
| 388 | +\newcommand{\SupertypeStd}[2]{\Supertype{\Delta}{#1}{#2}} |
352 | 389 |
|
353 | 390 | % Judgment expressing that an assignability relation exists.
|
354 | 391 | \newcommand{\AssignableRelationSymbol}{\ensuremath{\Longleftrightarrow}}
|
|
394 | 431 | \ensuremath{{#2}}%
|
395 | 432 | }
|
396 | 433 |
|
| 434 | +\newcommand{\FlattenName}{\metavar{flatten}} |
| 435 | +\newcommand{\Flatten}[1]{\ensuremath{\FlattenName(\code{#1})}} |
| 436 | + |
| 437 | +\newcommand{\NominalTypeDepthName}{\metavar{nominalTypeDepth}} |
| 438 | +\newcommand{\NominalTypeDepth}[1]{% |
| 439 | + \ensuremath{\NominalTypeDepthName(\code{#1})}} |
| 440 | + |
| 441 | +\newcommand{\TopMergeTypeName}{\metavar{topMergeType}} |
| 442 | +\newcommand{\TopMergeType}[2]{% |
| 443 | + \ensuremath{\TopMergeTypeName(\code{{#1},\,\,{#2}})}} |
| 444 | + |
| 445 | +\newcommand{\NonNullTypeName}{\metavar{nonNullType}} |
| 446 | +\newcommand{\NonNullType}[1]{\ensuremath{\NonNullTypeName(\code{#1})}} |
| 447 | + |
| 448 | +\newcommand{\IsTopTypeName}{\metavar{isTopType}} |
| 449 | +\newcommand{\IsTopType}[1]{\ensuremath{\IsTopTypeName(\code{#1})}} |
| 450 | + |
| 451 | +\newcommand{\IsObjectTypeName}{\metavar{isObjectType}} |
| 452 | +\newcommand{\IsObjectType}[1]{\ensuremath{\IsObjectTypeName(\code{#1})}} |
| 453 | + |
| 454 | +\newcommand{\IsBottomTypeName}{\metavar{isBottomType}} |
| 455 | +\newcommand{\IsBottomType}[1]{\ensuremath{\IsBottomTypeName(\code{#1})}} |
| 456 | + |
| 457 | +\newcommand{\IsNullTypeName}{\metavar{isNullType}} |
| 458 | +\newcommand{\IsNullType}[1]{\ensuremath{\IsNullTypeName(\code{#1})}} |
| 459 | + |
| 460 | +\newcommand{\IsMoreTopTypeName}{\metavar{isMoreTopType}} |
| 461 | +\newcommand{\IsMoreTopType}[2]{% |
| 462 | + \ensuremath{\IsMoreTopTypeName(\code{{#1},\,\,{#2}})}} |
| 463 | + |
| 464 | +\newcommand{\IsMoreBottomTypeName}{\metavar{isMoreBottomType}} |
| 465 | +\newcommand{\IsMoreBottomType}[2]{% |
| 466 | + \ensuremath{\IsMoreBottomTypeName(\code{{#1},\,\,{#2}})}} |
| 467 | + |
| 468 | +\newcommand{\NormalizedTypeOfName}{\metavar{normalizedType}} |
| 469 | +\newcommand{\NormalizedTypeOf}[1]{% |
| 470 | + \ensuremath{\NormalizedTypeOfName(\code{#1})}} |
| 471 | + |
| 472 | +\newcommand{\FutureValueTypeOfName}{\metavar{futureValueType}} |
| 473 | +\newcommand{\FutureValueTypeOf}[1]{% |
| 474 | + \ensuremath{\FutureValueTypeOfName(\code{#1})}} |
| 475 | + |
| 476 | +\newcommand{\UpperBoundTypeName}{\metavar{standardUpperBound}} |
| 477 | +\newcommand{\UpperBoundType}[2]{% |
| 478 | + \ensuremath{\UpperBoundTypeName(\code{{#1},\,\,{#2}})}} |
| 479 | + |
| 480 | +\newcommand{\LowerBoundTypeName}{\metavar{standardLowerBound}} |
| 481 | +\newcommand{\LowerBoundType}[2]{% |
| 482 | + \ensuremath{\LowerBoundTypeName(\code{{#1},\,\,{#2}})}} |
| 483 | + |
| 484 | +\newcommand{\DefEquals}[2]{\ensuremath{{#1}\stackrel{\vartriangle}{=}{#2}}} |
| 485 | +\newcommand{\DefEqualsNewline}[2]{ |
| 486 | + \ensuremath{{#1}\stackrel{\vartriangle}{=}}\\ |
| 487 | + \ensuremath{{#2}}% |
| 488 | +} |
| 489 | + |
397 | 490 | % ----------------------------------------------------------------------
|
398 | 491 | % Support for hash valued Location Markers
|
399 | 492 |
|
|
0 commit comments