/usr/share/doc/racket/reference/syntax-model.html is in racket-doc 6.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>1.2 Syntax Model</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="extras.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="icons.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">►</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x"><span style="font-weight: bold">The Racket Reference</span></a></td></tr></table></div><div class="tocviewsublisttop" style="display: none;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="model.html" class="tocviewselflink" data-pltdoc="x">Language Model</a></td></tr><tr><td align="right">2 </td><td><a href="notation.html" class="tocviewlink" data-pltdoc="x">Notation for Documentation</a></td></tr><tr><td align="right">3 </td><td><a href="syntax.html" class="tocviewlink" data-pltdoc="x">Syntactic Forms</a></td></tr><tr><td align="right">4 </td><td><a href="data.html" class="tocviewlink" data-pltdoc="x">Datatypes</a></td></tr><tr><td align="right">5 </td><td><a href="structures.html" class="tocviewlink" data-pltdoc="x">Structures</a></td></tr><tr><td align="right">6 </td><td><a href="mzlib_class.html" class="tocviewlink" data-pltdoc="x">Classes and Objects</a></td></tr><tr><td align="right">7 </td><td><a href="mzlib_unit.html" class="tocviewlink" data-pltdoc="x">Units</a></td></tr><tr><td align="right">8 </td><td><a href="contracts.html" class="tocviewlink" data-pltdoc="x">Contracts</a></td></tr><tr><td align="right">9 </td><td><a href="match.html" class="tocviewlink" data-pltdoc="x">Pattern Matching</a></td></tr><tr><td align="right">10 </td><td><a href="control.html" class="tocviewlink" data-pltdoc="x">Control Flow</a></td></tr><tr><td align="right">11 </td><td><a href="concurrency.html" class="tocviewlink" data-pltdoc="x">Concurrency and Parallelism</a></td></tr><tr><td align="right">12 </td><td><a href="Macros.html" class="tocviewlink" data-pltdoc="x">Macros</a></td></tr><tr><td align="right">13 </td><td><a href="input-and-output.html" class="tocviewlink" data-pltdoc="x">Input and Output</a></td></tr><tr><td align="right">14 </td><td><a href="security.html" class="tocviewlink" data-pltdoc="x">Reflection and Security</a></td></tr><tr><td align="right">15 </td><td><a href="os.html" class="tocviewlink" data-pltdoc="x">Operating System</a></td></tr><tr><td align="right">16 </td><td><a href="memory.html" class="tocviewlink" data-pltdoc="x">Memory Management</a></td></tr><tr><td align="right">17 </td><td><a href="unsafe.html" class="tocviewlink" data-pltdoc="x">Unsafe Operations</a></td></tr><tr><td align="right">18 </td><td><a href="running.html" class="tocviewlink" data-pltdoc="x">Running Racket</a></td></tr><tr><td align="right"></td><td><a href="doc-bibliography.html" class="tocviewlink" data-pltdoc="x">Bibliography</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">▼</a></td><td>1 </td><td><a href="model.html" class="tocviewlink" data-pltdoc="x">Language Model</a></td></tr></table><div class="tocviewsublist" style="display: block;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">1.1 </td><td><a href="eval-model.html" class="tocviewlink" data-pltdoc="x">Evaluation Model</a></td></tr><tr><td align="right">1.2 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Syntax Model</a></td></tr><tr><td align="right">1.3 </td><td><a href="reader.html" class="tocviewlink" data-pltdoc="x">The Reader</a></td></tr><tr><td align="right">1.4 </td><td><a href="printing.html" class="tocviewlink" data-pltdoc="x">The Printer</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_2");">►</a></td><td>1.2 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Syntax Model</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_2"><table cellspacing="0" cellpadding="0"><tr><td align="right">1.2.1 </td><td><a href="#%28part._id-model%29" class="tocviewlink" data-pltdoc="x">Identifiers and Binding</a></td></tr><tr><td align="right">1.2.2 </td><td><a href="#%28part._stxobj-model%29" class="tocviewlink" data-pltdoc="x">Syntax Objects</a></td></tr><tr><td align="right">1.2.3 </td><td><a href="#%28part._expansion%29" class="tocviewlink" data-pltdoc="x">Expansion (Parsing)</a></td></tr><tr><td align="right">1.2.4 </td><td><a href="#%28part._compilation-model%29" class="tocviewlink" data-pltdoc="x">Compilation</a></td></tr><tr><td align="right">1.2.5 </td><td><a href="#%28part._namespace-model%29" class="tocviewlink" data-pltdoc="x">Namespaces</a></td></tr><tr><td align="right">1.2.6 </td><td><a href="#%28part._infernames%29" class="tocviewlink" data-pltdoc="x">Inferred Value Names</a></td></tr><tr><td align="right">1.2.7 </td><td><a href="#%28part._cross-phase._persistent-grammar%29" class="tocviewlink" data-pltdoc="x">Cross-<wbr></wbr>Phase Persistent Module Declarations</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><span class="tocsublinknumber">1.2.1<tt> </tt></span><a href="#%28part._id-model%29" class="tocsubseclink" data-pltdoc="x">Identifiers and Binding</a></td></tr><tr><td><span class="tocsublinknumber">1.2.2<tt> </tt></span><a href="#%28part._stxobj-model%29" class="tocsubseclink" data-pltdoc="x">Syntax Objects</a></td></tr><tr><td><span class="tocsublinknumber">1.2.3<tt> </tt></span><a href="#%28part._expansion%29" class="tocsubseclink" data-pltdoc="x">Expansion (Parsing)</a></td></tr><tr><td><span class="tocsublinknumber">1.2.3.1<tt> </tt></span><a href="#%28part._fully-expanded%29" class="tocsubseclink" data-pltdoc="x">Fully Expanded Programs</a></td></tr><tr><td><span class="tocsublinknumber">1.2.3.2<tt> </tt></span><a href="#%28part._expand-steps%29" class="tocsubseclink" data-pltdoc="x">Expansion Steps</a></td></tr><tr><td><span class="tocsublinknumber">1.2.3.3<tt> </tt></span><a href="#%28part._expand-context-model%29" class="tocsubseclink" data-pltdoc="x">Expansion Context</a></td></tr><tr><td><span class="tocsublinknumber">1.2.3.4<tt> </tt></span><a href="#%28part._intro-binding%29" class="tocsubseclink" data-pltdoc="x">Introducing Bindings</a></td></tr><tr><td><span class="tocsublinknumber">1.2.3.5<tt> </tt></span><a href="#%28part._transformer-model%29" class="tocsubseclink" data-pltdoc="x">Transformer Bindings</a></td></tr><tr><td><span class="tocsublinknumber">1.2.3.6<tt> </tt></span><a href="#%28part._partial-expansion%29" class="tocsubseclink" data-pltdoc="x">Partial Expansion</a></td></tr><tr><td><span class="tocsublinknumber">1.2.3.7<tt> </tt></span><a href="#%28part._intdef-body%29" class="tocsubseclink" data-pltdoc="x">Internal Definitions</a></td></tr><tr><td><span class="tocsublinknumber">1.2.3.8<tt> </tt></span><a href="#%28part._mod-parse%29" class="tocsubseclink" data-pltdoc="x">Module Phases and Visits</a></td></tr><tr><td><span class="tocsublinknumber">1.2.3.9<tt> </tt></span><a href="#%28part._macro-introduced-bindings%29" class="tocsubseclink" data-pltdoc="x">Macro-<wbr></wbr>Introduced Bindings</a></td></tr><tr><td><span class="tocsublinknumber">1.2.4<tt> </tt></span><a href="#%28part._compilation-model%29" class="tocsubseclink" data-pltdoc="x">Compilation</a></td></tr><tr><td><span class="tocsublinknumber">1.2.5<tt> </tt></span><a href="#%28part._namespace-model%29" class="tocsubseclink" data-pltdoc="x">Namespaces</a></td></tr><tr><td><span class="tocsublinknumber">1.2.6<tt> </tt></span><a href="#%28part._infernames%29" class="tocsubseclink" data-pltdoc="x">Inferred Value Names</a></td></tr><tr><td><span class="tocsublinknumber">1.2.7<tt> </tt></span><a href="#%28part._cross-phase._persistent-grammar%29" class="tocsubseclink" data-pltdoc="x">Cross-<wbr></wbr>Phase Persistent Module Declarations</a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="eval-model.html" title="backward to "1.1 Evaluation Model"" data-pltdoc="x">← prev</a> <a href="model.html" title="up to "1 Language Model"" data-pltdoc="x">up</a> <a href="reader.html" title="forward to "1.3 The Reader"" data-pltdoc="x">next →</a></span> </div><h4 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""syntax-model"">1.2<tt> </tt><a name="(part._syntax-model)"></a>Syntax Model</h4><p>The syntax of a Racket program is defined by</p><ul><li><p>a <a name="(tech._read)"></a><span style="font-style: italic">read</span> pass that processes a character stream into a
<a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a>; and</p></li><li><p>an <a name="(tech._expand)"></a><span style="font-style: italic">expand</span> pass that processes a syntax object to
produce one that is fully parsed.</p></li></ul><p>For details on the <a href="#%28tech._read%29" class="techoutside" data-pltdoc="x"><span class="techinside">read</span></a> pass, see <a href="reader.html" data-pltdoc="x">The Reader</a>. Source
code is normally read in <span class="RktSym"><a href="Reading.html#%28def._%28%28quote._~23~25kernel%29._read-syntax%29%29" class="RktValLink" data-pltdoc="x">read-syntax</a></span> mode, which produces a
<a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a>.</p><p>The <a href="#%28tech._expand%29" class="techoutside" data-pltdoc="x"><span class="techinside">expand</span></a> pass recursively processes a <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a>
to produce a complete <a href="#%28tech._parse%29" class="techoutside" data-pltdoc="x"><span class="techinside">parse</span></a> of the program. <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">Binding</span></a>
information in a <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a> drives the <a href="#%28tech._expansion%29" class="techoutside" data-pltdoc="x"><span class="techinside">expansion</span></a>
process, and when the <a href="#%28tech._expansion%29" class="techoutside" data-pltdoc="x"><span class="techinside">expansion</span></a> process encounters a
<a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a> form, it extends syntax objects for sub-expression with
new binding information.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""id-model"">1.2.1<tt> </tt><a name="(part._id-model)"></a>Identifiers and Binding</h5><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p><span class="imageleft"><img src="finger.png" alt="+" width="24" height="24"/></span><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=binding.html&version=6.1" class="Sq" data-pltdoc="x">Identifiers and Binding</a> in <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=index.html&version=6.1" class="Sq" data-pltdoc="x"><span style="font-weight: bold">The Racket Guide</span></a> introduces binding.</p></blockquote></blockquote></blockquote><p>An <a name="(tech._identifier)"></a><span style="font-style: italic">identifier</span> is a source-program entity. Parsing (i.e.,
expanding) a Racket program reveals that some <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifiers</span></a>
correspond to <a href="eval-model.html#%28tech._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">variables</span></a>, some refer to syntactic forms, and
some are quoted to produce a symbol or a syntax object.</p><p>An identifier <a name="(tech._bind)"></a><span style="font-style: italic">binds</span> another (i.e., it is a
<a name="(tech._binding)"></a><span style="font-style: italic">binding</span>) when the former is parsed as a <a href="eval-model.html#%28tech._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">variable</span></a> and
the latter is parsed as a reference to the former; the latter is
<a name="(tech._bound)"></a><span style="font-style: italic">bound</span>. The <a name="(tech._scope)"></a><span style="font-style: italic">scope</span> of a <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a> is the set
of source forms to which it applies. The <a name="(tech._environment)"></a><span style="font-style: italic">environment</span> of a
form is the set of bindings whose <a href="#%28tech._scope%29" class="techoutside" data-pltdoc="x"><span class="techinside">scope</span></a> includes the form. A
binding for a sub-expression <a name="(tech._shadow)"></a><span style="font-style: italic">shadows</span> any <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">bindings</span></a>
(i.e., it is <a name="(tech._shadowing)"></a><span style="font-style: italic">shadowing</span>) in its <a href="#%28tech._environment%29" class="techoutside" data-pltdoc="x"><span class="techinside">environment</span></a>, so that
uses of an <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> refer to the <a href="#%28tech._shadowing%29" class="techoutside" data-pltdoc="x"><span class="techinside">shadowing</span></a>
<a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a>.</p><p>For example, as a bit of source, the text</p><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">5</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span></p></blockquote><p>includes two <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifiers</span></a>: <span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span> and <span class="RktSym">x</span> (which
appears twice). When this source is parsed in a typical
<a href="#%28tech._environment%29" class="techoutside" data-pltdoc="x"><span class="techinside">environment</span></a>, <span class="RktSym">x</span> turns out to represent a
<a href="eval-model.html#%28tech._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">variable</span></a> (unlike <span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span>). In particular, the first
<span class="RktSym">x</span> <a href="#%28tech._bind%29" class="techoutside" data-pltdoc="x"><span class="techinside">binds</span></a> the second <span class="RktSym">x</span>.</p><p>A <a name="(tech._top._level._binding)"></a><span style="font-style: italic">top-level binding</span> is a <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a> from a definition at
the top-level; a <a name="(tech._module._binding)"></a><span style="font-style: italic">module binding</span> is a binding from a
definition in a module; all other bindings are <a name="(tech._local._binding)"></a><span style="font-style: italic">local bindings</span>.
There is no difference between an <a name="(tech._unbound)"></a><span style="font-style: italic">unbound</span>
identifier and one with a <a href="#%28tech._top._level._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">top-level binding</span></a>; within a module,
references to <a href="#%28tech._top._level._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">top-level bindings</span></a> are disallowed, and so such
identifiers are called <a href="#%28tech._unbound%29" class="techoutside" data-pltdoc="x"><span class="techinside">unbound</span></a> in a module context.</p><p>Throughout the documentation, <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifiers</span></a> are typeset to
suggest the way that they are parsed. A black, boldface
<a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> like <span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29" class="RktStxLink" data-pltdoc="x">lambda</a></span> indicates a reference to a
syntactic form. A plain blue <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> like <span class="RktSym">x</span>
is a <a href="eval-model.html#%28tech._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">variable</span></a> or a reference to an unspecified <a href="eval-model.html#%28tech._top._level._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">top-level
variable</span></a>. A hyperlinked <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29" class="RktValLink" data-pltdoc="x">cons</a></span> is a
reference to a specific <a href="eval-model.html#%28tech._top._level._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">top-level variable</span></a>.</p><p>Every binding has a <a name="(tech._phase._level)"></a><span style="font-style: italic">phase level</span> in which it can be
referenced, where a <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> normally corresponds to an
integer (but the special <a href="#%28tech._label._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">label phase level</span></a> does not
correspond to an integer). <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">Phase level</span></a> 0 corresponds to the
run time of the enclosing module (or the run time of top-level
expressions). Bindings in <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 0 constitute the
<a name="(tech._base._environment)"></a><span style="font-style: italic">base environment</span>. <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">Phase level</span></a> 1 corresponds to the
time during which the enclosing module (or top-level expression) is
expanded; bindings in <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 1 constitute the
<a name="(tech._transformer._environment)"></a><span style="font-style: italic">transformer environment</span>. Phase level -1 corresponds to the
run time of a different module for which the enclosing module is
imported for use at <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 1 (relative to the importing
module); bindings in <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> -1 constitute the
<a name="(tech._template._environment)"></a><span style="font-style: italic">template environment</span>. The <a name="(tech._label._phase._level)"></a><span style="font-style: italic">label phase level</span> does not
correspond to any execution time; it is used to track bindings (e.g.,
to identifiers within documentation) without implying an execution
dependency.</p><p>If an identifier has a <a href="#%28tech._local._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">local binding</span></a>, then it is the same for
all phase levels, though the reference is allowed only at a particular
phase level. Attempting to reference a <a href="#%28tech._local._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">local binding</span></a> in a
different <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> from the binding’s context produces a
syntax error. If an identifier has a <a href="#%28tech._top._level._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">top-level binding</span></a> or
<a href="#%28tech._module._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">module binding</span></a>, then it can have different such bindings in
different phase levels.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""stxobj-model"">1.2.2<tt> </tt><a name="(part._stxobj-model)"></a>Syntax Objects</h5><p>A <a name="(tech._syntax._object)"></a><span style="font-style: italic">syntax object</span> combines a simpler Racket value, such as a
symbol or pair, with <a name="(tech._lexical._information)"></a><span style="font-style: italic">lexical information</span> about bindings,
source-location information, <a href="stxprops.html#%28tech._syntax._property%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax properties</span></a>, and
<a href="stxcerts.html#%28tech._tamper._statu%29" class="techoutside" data-pltdoc="x"><span class="techinside">tamper status</span></a>. In particular, an <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> is
represented as a symbol object that combines a symbol with lexical and
other information.</p><p>For example, a <span class="RktSym">car</span> <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> might have
<a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a> that designates it as the <span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._car%29%29" class="RktValLink" data-pltdoc="x">car</a></span> from
the <a href="index.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">racket/base</span></a> language (i.e., the built-in
<span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._car%29%29" class="RktValLink" data-pltdoc="x">car</a></span>). Similarly, a <span class="RktSym">lambda</span> identifier’s
<a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a> may indicate that it represents a procedure
form. Some other <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a>’s <a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a> may
indicate that it references a <a href="eval-model.html#%28tech._top._level._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">top-level variable</span></a>.</p><p>When a <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a> represents a more complex expression than
an <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> or simple constant, its internal components can
be extracted. Even for extracted identifiers, detailed information
about binding is available mostly indirectly; two identifiers can be
compared to determine whether they refer to the same binding (i.e.,
<span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._free-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">free-identifier=?</a></span>), or whether each identifier would bind the
other if one were in a binding position and the other in an expression
position (i.e., <span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._bound-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">bound-identifier=?</a></span>).</p><p>For example, when the program written as</p><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">5</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">6</span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote><p>is represented as a <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a>, then two <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax
objects</span></a> can be extracted for the two <span class="RktSym">x</span>s. Both the
<span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._free-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">free-identifier=?</a></span> and <span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._bound-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">bound-identifier=?</a></span> predicates
will indicate that the <span class="RktSym">x</span>s are the same. In contrast, the
<span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span> <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> is not <span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._free-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">free-identifier=?</a></span> or
<span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._bound-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">bound-identifier=?</a></span> to either <span class="RktSym">x</span>.</p><p>The <a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a> in a <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a> is
independent of the other half, and it can be copied to a new syntax
object in combination with an arbitrary other Racket value. Thus,
identifier-<a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a> information in a <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a> is
predicated on the symbolic name of the <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> as well as
the identifier’s <a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a>; the same question with
the same <a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a> but different base value can
produce a different answer.</p><p>For example, combining the lexical information from <span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span> in
the program above to <span class="RktVal">'</span><span class="RktVal">x</span> would not produce an identifier that
is <span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._free-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">free-identifier=?</a></span> to either <span class="RktSym">x</span>, since it does not
appear in the scope of the <span class="RktSym">x</span> binding. Combining the lexical
context of the <span class="RktVal">6</span> with <span class="RktVal">'</span><span class="RktVal">x</span>, in contrast, would produce
an identifier that is <span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._bound-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">bound-identifier=?</a></span> to both <span class="RktSym">x</span>s.</p><p>The <span class="RktSym"><a href="Syntax_Quoting__quote-syntax.html#%28form._%28%28quote._~23~25kernel%29._quote-syntax%29%29" class="RktStxLink" data-pltdoc="x">quote-syntax</a></span> form bridges the evaluation of a program and
the representation of a program. Specifically, <span class="RktPn">(</span><span class="RktSym"><a href="Syntax_Quoting__quote-syntax.html#%28form._%28%28quote._~23~25kernel%29._quote-syntax%29%29" class="RktStxLink" data-pltdoc="x">quote-syntax</a></span><span class="stt"> </span><span class="RktVar">datum</span><span class="RktPn">)</span> produces a syntax object that preserves all of the lexical
information that <span class="RktVar">datum</span> had when it was parsed as part of the
<span class="RktSym"><a href="Syntax_Quoting__quote-syntax.html#%28form._%28%28quote._~23~25kernel%29._quote-syntax%29%29" class="RktStxLink" data-pltdoc="x">quote-syntax</a></span> form.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""expansion"">1.2.3<tt> </tt><a name="(part._expansion)"></a>Expansion (Parsing)</h5><p><a name="(tech._expansion)"></a><span style="font-style: italic">Expansion</span> recursively processes a <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a> in a
particular phase level, starting with <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 0. <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">Bindings</span></a>
from the <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a>’s <a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a> drive the
expansion process, and cause new bindings to be introduced for the
lexical information of sub-expressions. In some cases, a
sub-expression is expanded in a deeper phase than the enclosing
expression.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""fully-expanded"">1.2.3.1<tt> </tt><a name="(part._fully-expanded)"></a>Fully Expanded Programs</h5><p>A complete expansion produces a <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a> matching the
following grammar:</p><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p>Beware that the symbolic names of identifiers in a fully
expanded program may not match the symbolic names in the grammar. Only
the binding (according to <span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._free-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">free-identifier=?</a></span>) matters.</p></blockquote></blockquote></blockquote><p><table cellspacing="0" cellpadding="0"><tr><td align="right" valign="baseline"><span class="hspace"> </span><span class="RktVar">top-level-form</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">general-top-level-form</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="__expression.html#%28form._%28%28quote._~23~25kernel%29._~23~25expression%29%29" class="RktStxLink" data-pltdoc="x">#%expression</a></span><span class="hspace"> </span><span class="RktVar">expr</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29" class="RktStxLink" data-pltdoc="x">module</a></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">module-path</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-module-begin%29%29" class="RktStxLink" data-pltdoc="x">#%plain-module-begin</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">module-level-form</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span><span class="hspace"> </span><span class="RktVar">top-level-form</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin-for-syntax%29%29" class="RktStxLink" data-pltdoc="x">begin-for-syntax</a></span><span class="hspace"> </span><span class="RktVar">top-level-form</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="hspace"> </span><span class="RktVar">module-level-form</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">general-top-level-form</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28quote._~23~25kernel%29._~23~25provide%29%29" class="RktStxLink" data-pltdoc="x">#%provide</a></span><span class="hspace"> </span><span class="RktVar">raw-provide-spec</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin-for-syntax%29%29" class="RktStxLink" data-pltdoc="x">begin-for-syntax</a></span><span class="hspace"> </span><span class="RktVar">module-level-form</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">submodule-form</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._~23~25declare%29%29" class="RktStxLink" data-pltdoc="x">#%declare</a></span><span class="hspace"> </span><span class="RktVar">declaration-keyword</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="hspace"> </span><span class="RktVar">submodule-form</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29" class="RktStxLink" data-pltdoc="x">module</a></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">module-path</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-module-begin%29%29" class="RktStxLink" data-pltdoc="x">#%plain-module-begin</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">module-level-form</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._module%2A%29%29" class="RktStxLink" data-pltdoc="x">module*</a></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">module-path</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-module-begin%29%29" class="RktStxLink" data-pltdoc="x">#%plain-module-begin</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">module-level-form</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._module%2A%29%29" class="RktStxLink" data-pltdoc="x">module*</a></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-module-begin%29%29" class="RktStxLink" data-pltdoc="x">#%plain-module-begin</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">module-level-form</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="hspace"> </span><span class="RktVar">general-top-level-form</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">expr</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-values%29%29" class="RktStxLink" data-pltdoc="x">define-values</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28quote._~23~25kernel%29._~23~25require%29%29" class="RktStxLink" data-pltdoc="x">#%require</a></span><span class="hspace"> </span><span class="RktVar">raw-require-spec</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="hspace"> </span><span class="RktVar">expr</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">id</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-lambda%29%29" class="RktStxLink" data-pltdoc="x">#%plain-lambda</a></span><span class="hspace"> </span><span class="RktVar">formals</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktSym">...+</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28quote._~23~25kernel%29._case-lambda%29%29" class="RktStxLink" data-pltdoc="x">case-lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">formals</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktSym">...+</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="if.html#%28form._%28%28quote._~23~25kernel%29._if%29%29" class="RktStxLink" data-pltdoc="x">if</a></span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktSym">...+</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin0%29%29" class="RktStxLink" data-pltdoc="x">begin0</a></span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._let-values%29%29" class="RktStxLink" data-pltdoc="x">let-values</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktSym">...+</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._letrec-values%29%29" class="RktStxLink" data-pltdoc="x">letrec-values</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="RktPn">]</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktSym">...+</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="set_.html#%28form._%28%28quote._~23~25kernel%29._set%21%29%29" class="RktStxLink" data-pltdoc="x">set!</a></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="quote.html#%28form._%28%28quote._~23~25kernel%29._quote%29%29" class="RktStxLink" data-pltdoc="x">quote</a></span><span class="hspace"> </span><span class="RktVar">datum</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="Syntax_Quoting__quote-syntax.html#%28form._%28%28quote._~23~25kernel%29._quote-syntax%29%29" class="RktStxLink" data-pltdoc="x">quote-syntax</a></span><span class="hspace"> </span><span class="RktVar">datum</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="wcm.html#%28form._%28%28quote._~23~25kernel%29._with-continuation-mark%29%29" class="RktStxLink" data-pltdoc="x">with-continuation-mark</a></span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="application.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-app%29%29" class="RktStxLink" data-pltdoc="x">#%plain-app</a></span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktSym">...+</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="__top.html#%28form._%28%28quote._~23~25kernel%29._~23~25top%29%29" class="RktStxLink" data-pltdoc="x">#%top</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktVar">id</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="Locations____variable-reference.html#%28form._%28%28quote._~23~25kernel%29._~23~25variable-reference%29%29" class="RktStxLink" data-pltdoc="x">#%variable-reference</a></span><span class="hspace"> </span><span class="RktVar">id</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="Locations____variable-reference.html#%28form._%28%28quote._~23~25kernel%29._~23~25variable-reference%29%29" class="RktStxLink" data-pltdoc="x">#%variable-reference</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="__top.html#%28form._%28%28quote._~23~25kernel%29._~23~25top%29%29" class="RktStxLink" data-pltdoc="x">#%top</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktVar">id</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="Locations____variable-reference.html#%28form._%28%28quote._~23~25kernel%29._~23~25variable-reference%29%29" class="RktStxLink" data-pltdoc="x">#%variable-reference</a></span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="hspace"> </span><span class="RktVar">formals</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktSym">...+</span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktVar">id</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">id</span></td></tr></table></p><p>A <a name="(tech._fully._expanded)"></a><span style="font-style: italic">fully-expanded</span> <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a> corresponds to a <a name="(tech._parse)"></a><span style="font-style: italic">parse</span>
of a program (i.e., a <a name="(tech._parsed)"></a><span style="font-style: italic">parsed</span> program), and <a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical
information</span></a> on its <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifiers</span></a> indicates the
<a href="#%28tech._parse%29" class="techoutside" data-pltdoc="x"><span class="techinside">parse</span></a>.</p><p>More specifically, the typesetting of identifiers in the above grammar
is significant. For example, the second case for <span class="RktVar">expr</span> is a
<a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax-object</span></a> list whose first element is an <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a>,
where the <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a>’s <a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a> specifies a
binding to the <span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-lambda%29%29" class="RktStxLink" data-pltdoc="x">#%plain-lambda</a></span> of the
<a href="index.html" class="RktModLink" data-pltdoc="x"><span class="RktSym">racket/base</span></a> language (i.e., the <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> is
<span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._free-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">free-identifier=?</a></span> to one whose binding is
<span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-lambda%29%29" class="RktStxLink" data-pltdoc="x">#%plain-lambda</a></span>). In all cases, identifiers above typeset as
syntactic-form names refer to the bindings defined in
<a href="syntax.html" data-pltdoc="x">Syntactic Forms</a>.</p><p>In a fully expanded program for a namespace whose <a href="#%28tech._base._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">base phase</span></a> is
0, the relevant <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> for a binding in the program is
<span style="font-style: italic">N</span> if the bindings has <span style="font-style: italic">N</span> surrounding
<span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin-for-syntax%29%29" class="RktStxLink" data-pltdoc="x">begin-for-syntax</a></span> and <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span> forms—<wbr></wbr>not
counting any <span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin-for-syntax%29%29" class="RktStxLink" data-pltdoc="x">begin-for-syntax</a></span> forms that wrap a
<span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29" class="RktStxLink" data-pltdoc="x">module</a></span> form for the body of the <span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29" class="RktStxLink" data-pltdoc="x">module</a></span>. The
<span class="RktVar">datum</span> in a <span class="RktSym"><a href="Syntax_Quoting__quote-syntax.html#%28form._%28%28quote._~23~25kernel%29._quote-syntax%29%29" class="RktStxLink" data-pltdoc="x">quote-syntax</a></span> form, however, always
preserves its information for all <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a>s.</p><p>In addition to the grammar above, <span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._letrec-syntaxes%2Bvalues%29%29" class="RktStxLink" data-pltdoc="x">letrec-syntaxes+values</a></span> can
appear in a fully local-expanded expression, as can
<span class="RktSym"><a href="__expression.html#%28form._%28%28quote._~23~25kernel%29._~23~25expression%29%29" class="RktStxLink" data-pltdoc="x">#%expression</a></span> in any expression position. For example,
<span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._letrec-syntaxes%2Bvalues%29%29" class="RktStxLink" data-pltdoc="x">letrec-syntaxes+values</a></span> and <span class="RktSym"><a href="__expression.html#%28form._%28%28quote._~23~25kernel%29._~23~25expression%29%29" class="RktStxLink" data-pltdoc="x">#%expression</a></span> can appear
in the result from <span class="RktSym"><a href="stxtrans.html#%28def._%28%28quote._~23~25kernel%29._local-expand%29%29" class="RktValLink" data-pltdoc="x">local-expand</a></span> when the stop list is empty.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""expand-steps"">1.2.3.2<tt> </tt><a name="(part._expand-steps)"></a>Expansion Steps</h5><p>In a recursive expansion, each single step in expanding a <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax
object</span></a> at a particular <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> depends on the immediate shape of
the <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a> being expanded:</p><ul><li><p>If it is an <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> (i.e., a syntax-object symbol),
then a <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a> is determined by the <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a>’s
<a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a>. If the <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> has a
<a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a> other than as a <a href="eval-model.html#%28tech._top._level._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">top-level variable</span></a>, that
<a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a> is used to continue. If the <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a>
has no <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a>, a new <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax-object</span></a> symbol
<span class="RktVal">'</span><span class="RktVal">#%top</span> is created using the <a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a>
of the <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a>; if this <span class="RktSym">#%top</span>
<a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> has no <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a> (other than as a
<a href="eval-model.html#%28tech._top._level._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">top-level variable</span></a>), then parsing fails with an
<span class="RktSym"><a href="exns.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._exn~3afail~3asyntax%29%29" class="RktValLink" data-pltdoc="x">exn:fail:syntax</a></span> exception. Otherwise, the new
<a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> is combined with the original
<a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> in a new <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax-object</span></a> pair (also
using the same <a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a> as the original
<a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a>), and the <span class="RktSym">#%top</span> <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a>
is used to continue.</p></li><li><p>If it is a <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax-object</span></a> pair whose first element is an
<a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a>, and if the <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> has a
<a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a> other than as a <a href="eval-model.html#%28tech._top._level._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">top-level variable</span></a>, then
the <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a>’s <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a> is used to continue.</p></li><li><p>If it is a <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax-object</span></a> pair of any other form, then a
new <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax-object</span></a> symbol <span class="RktVal">'</span><span class="RktVal">#%app</span> is created
using the <a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a> of the pair. If the
resulting <span class="RktSym">#%app</span> <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> has no
binding, parsing fails with an <span class="RktSym"><a href="exns.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._exn~3afail~3asyntax%29%29" class="RktValLink" data-pltdoc="x">exn:fail:syntax</a></span>
exception. Otherwise, the new <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> is combined
with the original pair to form a new <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax-object</span></a> pair
(also using the same <a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a> as the original
pair), and the <span class="RktSym">#%app</span> <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a> is used to
continue.</p></li><li><p>If it is any other syntax object, then a new
<a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax-object</span></a> symbol <span class="RktVal">'</span><span class="RktVal">#%datum</span> is created using
the <a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a> of the original <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax
object</span></a>. If the resulting <span class="RktSym">#%datum</span>
<a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> has no <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a>, parsing fails with an
<span class="RktSym"><a href="exns.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._exn~3afail~3asyntax%29%29" class="RktValLink" data-pltdoc="x">exn:fail:syntax</a></span> exception. Otherwise, the new
<a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> is combined with the original <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax
object</span></a> in a new <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax-object</span></a> pair (using the same
<a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a> as the original pair), and the
<span class="RktSym">#%datum</span> <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a> is used to continue.</p></li></ul><p>Thus, the possibilities that do not fail lead to an <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a>
with a particular <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a>. This binding refers to one of three
things:</p><ul><li><p>A <a href="#%28tech._transformer._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">transformer binding</span></a>, such as introduced by
<span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define-syntax%29%29" class="RktStxLink" data-pltdoc="x">define-syntax</a></span> or <span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let-syntax%29%29" class="RktStxLink" data-pltdoc="x">let-syntax</a></span>. If the
associated value is a procedure of one argument, the procedure
is called as a <a href="#%28tech._syntax._transformer%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax transformer</span></a> (described below), and
parsing starts again with the <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax-object</span></a> result. If
the <a href="#%28tech._transformer._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">transformer binding</span></a> is to any other kind of value,
parsing fails with an <span class="RktSym"><a href="exns.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._exn~3afail~3asyntax%29%29" class="RktValLink" data-pltdoc="x">exn:fail:syntax</a></span> exception. The
call to the <a href="#%28tech._syntax._transformer%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax transformer</span></a> is <span class="RktSym"><a href="parameters.html#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._parameterize%29%29" class="RktStxLink" data-pltdoc="x">parameterize</a></span>d
to set <span class="RktSym"><a href="Namespaces.html#%28def._%28%28quote._~23~25kernel%29._current-namespace%29%29" class="RktValLink" data-pltdoc="x">current-namespace</a></span> to a <a href="#%28tech._namespace%29" class="techoutside" data-pltdoc="x"><span class="techinside">namespace</span></a> that
shares <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">bindings</span></a> and <a href="eval-model.html#%28tech._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">variables</span></a> with the namespace
being used to expand, except that its <a href="#%28tech._base._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">base phase</span></a> is one
greater.</p></li><li><p>A <a href="eval-model.html#%28tech._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">variable</span></a> <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a>, such as introduced by a
module-level <span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span> or by <span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span>. In this case,
if the form being parsed is just an <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a>, then it
is parsed as a reference to the corresponding
<a href="eval-model.html#%28tech._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">variable</span></a>. If the form being parsed is a
<a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax-object</span></a> pair, then an <span class="RktSym"><a href="application.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25app%29%29" class="RktStxLink" data-pltdoc="x">#%app</a></span> is added to
the front of the <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax-object</span></a> pair in the same way as
when the first item in the <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax-object</span></a> pair is not an
identifier (third case in the previous enumeration), and
parsing continues.</p></li><li><p>A core <a name="(tech._syntactic._form)"></a><span style="font-style: italic">syntactic form</span>, which is parsed as described
for each form in <a href="syntax.html" data-pltdoc="x">Syntactic Forms</a>. Parsing a core syntactic
form typically involves recursive parsing of sub-forms, and may
introduce <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">bindings</span></a> that determine the parsing of
sub-forms.</p></li></ul><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""expand-context-model"">1.2.3.3<tt> </tt><a name="(part._expand-context-model)"></a>Expansion Context</h5><p>Each expansion step occurs in a particular <a name="(tech._context)"></a><span style="font-style: italic">context</span>, and
transformers and core syntactic forms may expand differently for
different <a href="#%28tech._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">contexts</span></a>. For example, a <span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29" class="RktStxLink" data-pltdoc="x">module</a></span> form is
allowed only in a <a href="#%28tech._top._level._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">top-level context</span></a>, and it fails in other
contexts. The possible <a href="#%28tech._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">contexts</span></a> are as follows:</p><ul><li><p><a name="(tech._top._level._context)"></a><span style="font-style: italic">top-level context</span> : outside of any module, definition, or
expression, except that sub-expressions of a top-level
<span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span> form are also expanded as top-level forms.</p></li><li><p><a name="(tech._module._begin._context)"></a><span style="font-style: italic">module-begin context</span> : inside the body of a module, as the
only form within the module.</p></li><li><p><a name="(tech._module._context)"></a><span style="font-style: italic">module context</span> : in the body of a module (inside the
module-begin layer).</p></li><li><p><a name="(tech._internal._definition._context)"></a><span style="font-style: italic">internal-definition context</span> : in a nested context that allows
both definitions and expressions.</p></li><li><p><a name="(tech._expression._context)"></a><span style="font-style: italic">expression context</span> : in a context where only
expressions are allowed.</p></li></ul><p>Different core <a href="#%28tech._syntactic._form%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntactic forms</span></a> parse sub-forms using different
<a href="#%28tech._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">contexts</span></a>. For example, a <span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span> form always parses the
right-hand expressions of a binding in an <a href="#%28tech._expression._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">expression context</span></a>,
but it starts parsing the body in an <a href="#%28tech._internal._definition._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">internal-definition
context</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""intro-binding"">1.2.3.4<tt> </tt><a name="(part._intro-binding)"></a>Introducing Bindings</h5><p><a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">Bindings</span></a> are introduced during <a href="#%28tech._expansion%29" class="techoutside" data-pltdoc="x"><span class="techinside">expansion</span></a> when certain
core syntactic forms are encountered:</p><ul><li><p>When a <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span> form is encountered at the top level or
module level, all lexical information derived from the top
level or the specific module’s level is extended with bindings
from the specified modules. If not otherwise indicated in the
<span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span> form, bindings are introduced at the
<a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a>s specified by the exporting modules:
<a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 0 for each normal <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span>,
<a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 1 for each <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for-syntax%29%29" class="RktStxLink" data-pltdoc="x">for-syntax</a></span>
<span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span>, and so on. The <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for-meta%29%29" class="RktStxLink" data-pltdoc="x">for-meta</a></span>
<span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span> form allows exports at an arbitrary
<a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> (as long as a binding exists within the
module at the <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a>).</p><p>A <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for-syntax%29%29" class="RktStxLink" data-pltdoc="x">for-syntax</a></span> sub-form within <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span> imports
similarly, but the resulting bindings have a <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a>
that is one more than the exported <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase levels</span></a>, when
exports for the <a href="#%28tech._label._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">label phase level</span></a> are still imported at
the <a href="#%28tech._label._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">label phase level</span></a>. More generally, a
<span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for-meta%29%29" class="RktStxLink" data-pltdoc="x">for-meta</a></span> sub-form within <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span> imports with
the specified <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> shift; if the specified shift
is <span class="RktVal">#f</span>, or if <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for-label%29%29" class="RktStxLink" data-pltdoc="x">for-label</a></span> is used to import,
then all bindings are imported into the <a href="#%28tech._label._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">label phase
level</span></a>.</p></li><li><p>When a <span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span>, <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-values%29%29" class="RktStxLink" data-pltdoc="x">define-values</a></span>,
<span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define-syntax%29%29" class="RktStxLink" data-pltdoc="x">define-syntax</a></span>, or <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span> form is
encountered at the top level or module level, all lexical
information derived from the top level or the specific module’s
level is extended with bindings for the specified identifiers
at <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 0 (i.e., the <a href="#%28tech._base._environment%29" class="techoutside" data-pltdoc="x"><span class="techinside">base environment</span></a> is
extended).</p></li><li><p>When a <span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin-for-syntax%29%29" class="RktStxLink" data-pltdoc="x">begin-for-syntax</a></span> form is encountered at the top
level or module level, bindings are introduced as for
<span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-values%29%29" class="RktStxLink" data-pltdoc="x">define-values</a></span> and <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span>, but at
<a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 1 (i.e., the <a href="#%28tech._transformer._environment%29" class="techoutside" data-pltdoc="x"><span class="techinside">transformer environment</span></a>
is extended). More generally, <span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin-for-syntax%29%29" class="RktStxLink" data-pltdoc="x">begin-for-syntax</a></span> forms
can be nested, an each <span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin-for-syntax%29%29" class="RktStxLink" data-pltdoc="x">begin-for-syntax</a></span> shifts its
body definition by one <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a>.</p></li><li><p>When a <span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._let-values%29%29" class="RktStxLink" data-pltdoc="x">let-values</a></span> form is encountered, the body of the
<span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._let-values%29%29" class="RktStxLink" data-pltdoc="x">let-values</a></span> form is extended (by creating new
<a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax objects</span></a>) with bindings for the specified
identifiers. The same bindings are added to the identifiers
themselves, so that the identifiers in binding position are
<span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._bound-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">bound-identifier=?</a></span> to uses in the fully expanded form,
and so they are not <span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._bound-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">bound-identifier=?</a></span> to other
identifiers. The bindings are available for use at the
<a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> at which the <span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._let-values%29%29" class="RktStxLink" data-pltdoc="x">let-values</a></span> form is
expanded.</p></li><li><p>When a <span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._letrec-values%29%29" class="RktStxLink" data-pltdoc="x">letrec-values</a></span> or
<span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._letrec-syntaxes%2Bvalues%29%29" class="RktStxLink" data-pltdoc="x">letrec-syntaxes+values</a></span> form is encountered, bindings
are added as for <span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._let-values%29%29" class="RktStxLink" data-pltdoc="x">let-values</a></span>, except that the
right-hand-side expressions are also extended with the
bindings.</p></li><li><p>Definitions in <a href="#%28tech._internal._definition._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">internal-definition contexts</span></a> introduce
bindings as described in <a href="#%28part._intdef-body%29" data-pltdoc="x">Internal Definitions</a>.</p></li></ul><p>A new binding in lexical information maps to a new variable. The
identifiers mapped to this variable are those that currently have the
same binding (i.e., that are currently <span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._bound-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">bound-identifier=?</a></span>) to
the identifier associated with the binding.</p><p>For example, in</p><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._let-values%29%29" class="RktStxLink" data-pltdoc="x">let-values</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">10</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._%2B%29%29" class="RktValLink" data-pltdoc="x">+</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktSym">y</span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote><p>the binding introduced for <span class="RktSym">x</span> applies to the <span class="RktSym">x</span> in the
body, but not the <span class="RktSym">y</span> in the body, because (at the point in
expansion where the <span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._let-values%29%29" class="RktStxLink" data-pltdoc="x">let-values</a></span> form is encountered) the
binding <span class="RktSym">x</span> and the body <span class="RktSym">y</span> are not
<span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._bound-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">bound-identifier=?</a></span>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""transformer-model"">1.2.3.5<tt> </tt><a name="(part._transformer-model)"></a>Transformer Bindings</h5><p>In a <a href="#%28tech._top._level._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">top-level context</span></a> or <a href="#%28tech._module._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">module context</span></a>, when the
expander encounters a <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span> form, the binding that
it introduces for the defined identifiers is a <a name="(tech._transformer._binding)"></a><span style="font-style: italic">transformer
binding</span>. The <a href="eval-model.html#%28tech._value%29" class="techoutside" data-pltdoc="x"><span class="techinside">value</span></a> of the <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">binding</span></a> exists at expansion
time, rather than run time (though the two times can overlap), though
the binding itself is introduced with <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 0 (i.e., in
the <a href="#%28tech._base._environment%29" class="techoutside" data-pltdoc="x"><span class="techinside">base environment</span></a>).</p><p>The <a href="eval-model.html#%28tech._value%29" class="techoutside" data-pltdoc="x"><span class="techinside">value</span></a> for the binding is obtained by evaluating the
expression in the <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span> form. This expression must
be <a href="#%28tech._expand%29" class="techoutside" data-pltdoc="x"><span class="techinside">expand</span></a>ed (i.e., parsed) before it can be evaluated, and it is
expanded at <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 1 (i.e., in the <a href="#%28tech._transformer._environment%29" class="techoutside" data-pltdoc="x"><span class="techinside">transformer
environment</span></a>) instead of <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 0.</p><p>If the resulting <span class="RktSym">value</span> is a procedure of one argument or
the result of <span class="RktSym"><a href="stxtrans.html#%28def._%28%28quote._~23~25kernel%29._make-set%21-transformer%29%29" class="RktValLink" data-pltdoc="x">make-set!-transformer</a></span> on a procedure, then it
is used as a <a name="(tech._syntax._transformer)"></a><span style="font-style: italic">syntax transformer</span> (a.k.a. <a name="(tech._macro)"></a><span style="font-style: italic">macro</span>).
The procedure is expected to accept a syntax object and return a
syntax object. A use of the binding (at <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 0) triggers
a call of the <a href="#%28tech._syntax._transformer%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax transformer</span></a> by the expander; see
<a href="#%28part._expand-steps%29" data-pltdoc="x">Expansion Steps</a>.</p><p>Before the expander passes a <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a> to a transformer,
the <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a> is extended with a <a name="(tech._syntax._mark)"></a><span style="font-style: italic">syntax mark</span> (that
applies to all sub-<a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax objects</span></a>). The result of the
transformer is similarly extended with the same <a href="#%28tech._syntax._mark%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax
mark</span></a>. When a <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a>’s <a href="#%28tech._lexical._information%29" class="techoutside" data-pltdoc="x"><span class="techinside">lexical information</span></a>
includes the same mark twice in a row, the marks effectively
cancel. Otherwise, two identifiers are <span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._bound-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">bound-identifier=?</a></span>
(that is, one can bind the other) only if they have the same binding
and if they have the same marks—<wbr></wbr>counting only marks that were added
after the binding.</p><p>This marking process helps keep binding in an expanded program
consistent with the lexical structure of the source program. For
example, the expanded form of the program</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">12</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define-syntax%29%29" class="RktStxLink" data-pltdoc="x">define-syntax</a></span><span class="hspace"> </span><span class="RktSym">m</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._syntax-rules%29%29" class="RktStxLink" data-pltdoc="x">syntax-rules</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29.__%29%29" class="RktStxLink" data-pltdoc="x">_</a></span><span class="hspace"> </span><span class="RktSym">id</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">10</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">id</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym">m</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr></table></blockquote><p>is</p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">12</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define-syntax%29%29" class="RktStxLink" data-pltdoc="x">define-syntax</a></span><span class="hspace"> </span><span class="RktSym">m</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._syntax-rules%29%29" class="RktStxLink" data-pltdoc="x">syntax-rules</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29.__%29%29" class="RktStxLink" data-pltdoc="x">_</a></span><span class="hspace"> </span><span class="RktSym">id</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">10</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">id</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._let-values%29%29" class="RktStxLink" data-pltdoc="x">let-values</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">10</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr></table></blockquote><p>However, the result of the last expression is <span class="RktVal">12</span>, not
<span class="RktVal">10</span>. The reason is that the transformer bound to <span class="RktSym">m</span>
introduces the binding <span class="RktSym">x</span>, but the referencing <span class="RktSym">x</span> is
present in the argument to the transformer. The introduced <span class="RktSym">x</span>
is the one left with a mark, and the reference <span class="RktSym">x</span> has no mark,
so the binding <span class="RktSym">x</span> is not <span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._bound-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">bound-identifier=?</a></span> to the
body <span class="RktSym">x</span>.</p><p>The <span class="RktSym"><a href="set_.html#%28form._%28%28quote._~23~25kernel%29._set%21%29%29" class="RktStxLink" data-pltdoc="x">set!</a></span> form works with the <span class="RktSym"><a href="stxtrans.html#%28def._%28%28quote._~23~25kernel%29._make-set%21-transformer%29%29" class="RktValLink" data-pltdoc="x">make-set!-transformer</a></span>
and <span class="RktSym"><a href="stxtrans.html#%28def._%28%28quote._~23~25kernel%29._prop~3aset%21-transformer%29%29" class="RktValLink" data-pltdoc="x">prop:set!-transformer</a></span> property to support
<a name="(tech._assignment._transformer)"></a><span style="font-style: italic">assignment transformers</span> that transform <span class="RktSym"><a href="set_.html#%28form._%28%28quote._~23~25kernel%29._set%21%29%29" class="RktStxLink" data-pltdoc="x">set!</a></span>
expressions. An <a href="#%28tech._assignment._transformer%29" class="techoutside" data-pltdoc="x"><span class="techinside">assignment transformer</span></a> contains a procedure
that is applied by <span class="RktSym"><a href="set_.html#%28form._%28%28quote._~23~25kernel%29._set%21%29%29" class="RktStxLink" data-pltdoc="x">set!</a></span> in the same way as a normal
transformer by the expander.</p><p>The <span class="RktSym"><a href="stxtrans.html#%28def._%28%28quote._~23~25kernel%29._make-rename-transformer%29%29" class="RktValLink" data-pltdoc="x">make-rename-transformer</a></span> procedure or
<span class="RktSym"><a href="stxtrans.html#%28def._%28%28quote._~23~25kernel%29._prop~3arename-transformer%29%29" class="RktValLink" data-pltdoc="x">prop:rename-transformer</a></span> property creates a value that is also
handled specially by the expander and by <span class="RktSym"><a href="set_.html#%28form._%28%28quote._~23~25kernel%29._set%21%29%29" class="RktStxLink" data-pltdoc="x">set!</a></span> as a
transformer binding’s value. When <span class="RktVar">id</span> is bound to a
<a name="(tech._rename._transformer)"></a><span style="font-style: italic">rename transformer</span> produced by
<span class="RktSym"><a href="stxtrans.html#%28def._%28%28quote._~23~25kernel%29._make-rename-transformer%29%29" class="RktValLink" data-pltdoc="x">make-rename-transformer</a></span>, it is replaced with the target
identifier passed to <span class="RktSym"><a href="stxtrans.html#%28def._%28%28quote._~23~25kernel%29._make-rename-transformer%29%29" class="RktValLink" data-pltdoc="x">make-rename-transformer</a></span>. In addition, as
long as the target identifier does not have a true value for the
<span class="RktVal">'</span><span class="RktVal">not-free-identifier=?</span> <a href="stxprops.html#%28tech._syntax._property%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax property</span></a>, the lexical information that
contains the binding of <span class="RktVar">id</span> is also enriched so that
<span class="RktVar">id</span> is <span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._free-identifier~3d~3f%29%29" class="RktValLink" data-pltdoc="x">free-identifier=?</a></span> to the target identifier,
<span class="RktSym"><a href="stxcmp.html#%28def._%28%28quote._~23~25kernel%29._identifier-binding%29%29" class="RktValLink" data-pltdoc="x">identifier-binding</a></span> returns the same results for both
identifiers, and <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span> exports <span class="RktVar">id</span> as the target
identifier. Finally, the binding is treated specially by
<span class="RktSym"><a href="stxtrans.html#%28def._%28%28quote._~23~25kernel%29._syntax-local-value%29%29" class="RktValLink" data-pltdoc="x">syntax-local-value</a></span>, and
<span class="RktSym"><a href="stxtrans.html#%28def._%28%28quote._~23~25kernel%29._syntax-local-make-delta-introducer%29%29" class="RktValLink" data-pltdoc="x">syntax-local-make-delta-introducer</a></span> as used by <a href="#%28tech._syntax._transformer%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax
transformer</span></a>s.</p><p>In addition to using marks to track introduced identifiers, the
expander tracks the expansion history of a form through <a href="stxprops.html#%28tech._syntax._property%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax
properties</span></a> such as <span class="RktVal">'</span><span class="RktVal">origin</span>. See <a href="stxprops.html" data-pltdoc="x">Syntax Object Properties</a> for
more information.</p><p>Finally, the expander uses a <a href="stxcerts.html#%28tech._tamper._statu%29" class="techoutside" data-pltdoc="x"><span class="techinside">tamper status</span></a> to control the way
that unexported and protected <a href="#%28tech._module._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">module bindings</span></a> are used. See
<a href="stxcerts.html" data-pltdoc="x">Syntax Taints</a> for more information on a <a href="stxcerts.html#%28tech._tamper._statu%29" class="techoutside" data-pltdoc="x"><span class="techinside">tamper status</span></a>.</p><p>The expander’s handling of <span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._letrec-syntaxes%2Bvalues%29%29" class="RktStxLink" data-pltdoc="x">letrec-syntaxes+values</a></span> is similar
to its handling of <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span>. A
<span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._letrec-syntaxes%2Bvalues%29%29" class="RktStxLink" data-pltdoc="x">letrec-syntaxes+values</a></span> can be expanded in an arbitrary phase
level <span style="font-style: italic">n</span> (not just 0), in which case the expression for the
<a href="#%28tech._transformer._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">transformer binding</span></a> is expanded at <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> <span style="font-style: italic">n+</span>1<span style="font-style: italic"></span>.</p><p>The expressions in a <span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin-for-syntax%29%29" class="RktStxLink" data-pltdoc="x">begin-for-syntax</a></span> form are expanded and
evaluated in the same way as for <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span>. However,
any introduced bindings from definition within
<span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin-for-syntax%29%29" class="RktStxLink" data-pltdoc="x">begin-for-syntax</a></span> are at <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 1 (not a
<a href="#%28tech._transformer._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">transformer binding</span></a> at <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 0).</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""partial-expansion"">1.2.3.6<tt> </tt><a name="(part._partial-expansion)"></a>Partial Expansion</h5><p>In certain contexts, such as an <a href="#%28tech._internal._definition._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">internal-definition context</span></a> or
<a href="#%28tech._module._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">module context</span></a>, <a name="(tech._partial._expansion)"></a><span style="font-style: italic">partial expansion</span> is used to determine
whether forms represent definitions, expressions, or other declaration
forms. Partial expansion works by cutting off the normal recursion
expansion when the relevant binding is for a primitive syntactic form.</p><p>As a special case, when expansion would otherwise add an
<span class="RktSym">#%app</span>, <span class="RktSym">#%datum</span>, or <span class="RktSym">#%top</span>
identifier to an expression, and when the binding turns out to be the
primitive <span class="RktSym"><a href="application.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25app%29%29" class="RktStxLink" data-pltdoc="x">#%app</a></span>, <span class="RktSym"><a href="quote.html#%28form._%28%28quote._~23~25kernel%29._~23~25datum%29%29" class="RktStxLink" data-pltdoc="x">#%datum</a></span>, or <span class="RktSym"><a href="__top.html#%28form._%28%28quote._~23~25kernel%29._~23~25top%29%29" class="RktStxLink" data-pltdoc="x">#%top</a></span> form,
then expansion stops without adding the identifier.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""intdef-body"">1.2.3.7<tt> </tt><a name="(part._intdef-body)"></a>Internal Definitions</h5><p>An <a href="#%28tech._internal._definition._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">internal-definition context</span></a> supports local definitions mixed
with expressions. Forms that allow internal definitions document such
positions using the <span class="RktVar">body</span> meta-variable. Definitions in an
internal-definition context are equivalent to local binding via
<span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._letrec-syntaxes%2Bvalues%29%29" class="RktStxLink" data-pltdoc="x">letrec-syntaxes+values</a></span>; macro expansion converts internal
definitions to a <span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._letrec-syntaxes%2Bvalues%29%29" class="RktStxLink" data-pltdoc="x">letrec-syntaxes+values</a></span> form.</p><p>Expansion of an internal-definition context relies on <a href="#%28tech._partial._expansion%29" class="techoutside" data-pltdoc="x"><span class="techinside">partial
expansion</span></a> of each <span class="RktVar">body</span> in an internal-definition sequence.
Partial expansion of each <span class="RktVar">body</span> produces a form matching one
of the following cases:</p><ul><li><p>A <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-values%29%29" class="RktStxLink" data-pltdoc="x">define-values</a></span> form: The lexical context of all
syntax objects for the body sequence is immediately enriched
with bindings for the <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-values%29%29" class="RktStxLink" data-pltdoc="x">define-values</a></span> form. Further
expansion of the definition is deferred, and partial expansion
continues with the rest of the body.</p></li><li><p>A <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span> form: The right-hand side is
expanded and evaluated (as for a
<span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._letrec-syntaxes%2Bvalues%29%29" class="RktStxLink" data-pltdoc="x">letrec-syntaxes+values</a></span> form), and a transformer
binding is installed for the body sequence before partial
expansion continues with the est of the body.</p></li><li><p>A primitive expression form other than <span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span>: Further
expansion of the expression is deferred, and partial expansion
continues with the rest of the body.</p></li><li><p>A <span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span> form: The sub-forms of the <span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span> are
spliced into the internal-definition sequence, and partial
expansion continues with the first of the newly-spliced forms
(or the next form, if the <span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span> had no sub-forms).</p></li></ul><p>After all body forms are partially expanded, if no definitions were
encountered, then the expressions are collected into a <span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span>
form as the internal-definition context’s expansion. Otherwise, at
least one expression must appear after the last definition, and any
<span class="RktVar">expr</span> that appears between definitions is converted to
<span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-values%29%29" class="RktStxLink" data-pltdoc="x">define-values</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktPn">)</span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span><span class="stt"> </span><span class="RktVar">expr</span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="values.html#%28def._%28%28quote._~23~25kernel%29._values%29%29" class="RktValLink" data-pltdoc="x">values</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span>; the definitions
are then converted to bindings in a <span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._letrec-syntaxes%2Bvalues%29%29" class="RktStxLink" data-pltdoc="x">letrec-syntaxes+values</a></span>
form, and all expressions after the last definition become the body of
the <span class="RktSym"><a href="let.html#%28form._%28%28quote._~23~25kernel%29._letrec-syntaxes%2Bvalues%29%29" class="RktStxLink" data-pltdoc="x">letrec-syntaxes+values</a></span> form.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""mod-parse"">1.2.3.8<tt> </tt><a name="(part._mod-parse)"></a>Module Phases and Visits</h5><p>A <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span> form not only introduces <a href="#%28tech._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">bindings</span></a> at
expansion time, but also <a name="(tech._visit)"></a><span style="font-style: italic">visits</span> the referenced module when
it is encountered by the expander. That is, the expander instantiates
any variables defined in the module within <span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin-for-syntax%29%29" class="RktStxLink" data-pltdoc="x">begin-for-syntax</a></span>,
and it also evaluates all expressions for <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span>
<a href="#%28tech._transformer._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">transformer bindings</span></a>.</p><p>Module <a href="#%28tech._visit%29" class="techoutside" data-pltdoc="x"><span class="techinside">visits</span></a> propagate through <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span>s in the same
way as module <a href="eval-model.html#%28tech._instantiation%29" class="techoutside" data-pltdoc="x"><span class="techinside">instantiation</span></a>. Moreover, when a module is
<a href="#%28tech._visit%29" class="techoutside" data-pltdoc="x"><span class="techinside">visit</span></a>ed at <a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase</span></a> 0, any module that it <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span>s
<span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for-syntax%29%29" class="RktStxLink" data-pltdoc="x">for-syntax</a></span> is <a href="eval-model.html#%28tech._instantiate%29" class="techoutside" data-pltdoc="x"><span class="techinside">instantiate</span></a>d at <a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase</span></a> 1, while
further <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span>s <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for-template%29%29" class="RktStxLink" data-pltdoc="x">for-template</a></span> leading back
to <a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase</span></a> 0 causes the required module to be visited at
<a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase</span></a> 0 (i.e., not <a href="eval-model.html#%28tech._instantiate%29" class="techoutside" data-pltdoc="x"><span class="techinside">instantiate</span></a>d).</p><p>During compilation, the top-level of module context is itself
implicitly <a href="#%28tech._visit%29" class="techoutside" data-pltdoc="x"><span class="techinside">visit</span></a>ed. Thus, when the expander encounters
<span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for-syntax%29%29" class="RktStxLink" data-pltdoc="x">for-syntax</a></span><span class="stt"> </span><span class="RktSym">....</span><span class="RktPn">)</span><span class="RktPn">)</span>, it immediately
<a href="eval-model.html#%28tech._instantiate%29" class="techoutside" data-pltdoc="x"><span class="techinside">instantiate</span></a>s the required module at <a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase</span></a> 1, in addition
to adding bindings at <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> 1 (i.e., the
<a href="#%28tech._transformer._environment%29" class="techoutside" data-pltdoc="x"><span class="techinside">transformer environment</span></a>). Similarly, the expander immediately
evaluates any form that it encounters within
<span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin-for-syntax%29%29" class="RktStxLink" data-pltdoc="x">begin-for-syntax</a></span>.</p><p><a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">Phases</span></a> beyond 0 are <a href="#%28tech._visit%29" class="techoutside" data-pltdoc="x"><span class="techinside">visit</span></a>ed on demand. For example,
when the right-hand side of a <a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase</span></a>-0 <span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let-syntax%29%29" class="RktStxLink" data-pltdoc="x">let-syntax</a></span> is to
be expanded, then modules that are <a href="eval-model.html#%28tech._available%29" class="techoutside" data-pltdoc="x"><span class="techinside">available</span></a> at <a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase</span></a> 1
are visited. More generally, initiating expansion at <a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase</span></a>
<span style="font-style: italic">n</span> <a href="#%28tech._visit%29" class="techoutside" data-pltdoc="x"><span class="techinside">visit</span></a>s modules at <a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase</span></a> <span style="font-style: italic">n</span>, which in turn
<a href="eval-model.html#%28tech._instantiate%29" class="techoutside" data-pltdoc="x"><span class="techinside">instantiates</span></a> modules at <a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase</span></a> <span style="font-style: italic">n+</span>1<span style="font-style: italic"></span>. These
<a href="#%28tech._visit%29" class="techoutside" data-pltdoc="x"><span class="techinside">visits</span></a> and <a href="eval-model.html#%28tech._instantiation%29" class="techoutside" data-pltdoc="x"><span class="techinside">instantiations</span></a> apply to <a href="eval-model.html#%28tech._available%29" class="techoutside" data-pltdoc="x"><span class="techinside">available</span></a>
modules in the enclosing <a href="#%28tech._namespace%29" class="techoutside" data-pltdoc="x"><span class="techinside">namespace</span></a>’s <a href="#%28tech._module._registry%29" class="techoutside" data-pltdoc="x"><span class="techinside">module registry</span></a>;
a per-registry lock prevents multiple threads from concurrently
instantiating and visiting available modules.</p><p>When the expander encounters <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span> and <span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span><span class="stt"> </span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._for-syntax%29%29" class="RktStxLink" data-pltdoc="x">for-syntax</a></span><span class="stt"> </span><span class="RktSym">....</span><span class="RktPn">)</span><span class="RktPn">)</span> within a <a href="#%28tech._module._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">module context</span></a>, the resulting
<a href="#%28tech._visit%29" class="techoutside" data-pltdoc="x"><span class="techinside">visits</span></a> and <a href="eval-model.html#%28tech._instantiation%29" class="techoutside" data-pltdoc="x"><span class="techinside">instantiations</span></a> are specific to the expansion
of the enclosing module, and are kept separate from <a href="#%28tech._visit%29" class="techoutside" data-pltdoc="x"><span class="techinside">visits</span></a> and
<a href="eval-model.html#%28tech._instantiation%29" class="techoutside" data-pltdoc="x"><span class="techinside">instantiations</span></a> triggered from a <a href="#%28tech._top._level._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">top-level context</span></a> or
from the expansion of a different module. Along the same lines, when a
module is attached to a namespace through
<span class="RktSym"><a href="Namespaces.html#%28def._%28%28quote._~23~25kernel%29._namespace-attach-module%29%29" class="RktValLink" data-pltdoc="x">namespace-attach-module</a></span>, modules that it <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span>s
are transitively attached, but instances are attached only at
phases at or below the namespace’s <a href="#%28tech._base._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">base phase</span></a>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""macro-introduced-bindings"">1.2.3.9<tt> </tt><a name="(part._macro-introduced-bindings)"></a>Macro-Introduced Bindings</h5><p>When a top-level definition binds an identifier that originates from a
macro expansion, the definition captures only uses of the identifier
that are generated by the same expansion. This behavior is consistent
with expansion in <a href="#%28tech._internal._definition._context%29" class="techoutside" data-pltdoc="x"><span class="techinside">internal-definition contexts</span></a>, where the
defined identifier turns into a fresh lexical binding.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define-syntax%29%29" class="RktStxLink" data-pltdoc="x">define-syntax</a></span><span class="hspace"> </span><span class="RktSym">def-and-use-of-x</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._syntax-rules%29%29" class="RktStxLink" data-pltdoc="x">syntax-rules</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">def-and-use-of-x</span><span class="hspace"> </span><span class="RktSym">val</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktSym">x</span><span class="RktCmt"> below originates from this macro:</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktSym">val</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">1</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktSym">x</span></td></tr><tr><td><p><span class="RktRes">1</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym">def-and-use-of-x</span><span class="hspace"> </span><span class="RktVal">2</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">2</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktSym">x</span></td></tr><tr><td><p><span class="RktRes">1</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define-syntax%29%29" class="RktStxLink" data-pltdoc="x">define-syntax</a></span><span class="hspace"> </span><span class="RktSym">def-and-use</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._syntax-rules%29%29" class="RktStxLink" data-pltdoc="x">syntax-rules</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">def-and-use</span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktSym">val</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktVal">"x"</span><span class="RktCmt"> below was provided by the macro use:</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktSym">val</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym">def-and-use</span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">3</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">3</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktSym">x</span></td></tr><tr><td><p><span class="RktRes">3</span></p></td></tr></table></blockquote></td></tr></table></p><p>For a top-level definition (outside of a module), the order of
evaluation affects the binding of a generated definition for a
generated identifier use. If the use precedes the definition, then
the use refers to a non-generated binding, just as if the generated
definition were not present. (No such dependency on order occurs
within a module, since a module binding covers the entire module
body.) To support the declaration of an identifier before its use,
the <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span> form avoids binding an identifier if the
body of the <span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span> declaration produces zero
results.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">bucket-1</span><span class="hspace"> </span><span class="RktVal">0</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">bucket-2</span><span class="hspace"> </span><span class="RktVal">0</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define-syntax%29%29" class="RktStxLink" data-pltdoc="x">define-syntax</a></span><span class="hspace"> </span><span class="RktSym">def-and-set!-use-of-x</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._syntax-rules%29%29" class="RktStxLink" data-pltdoc="x">syntax-rules</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">def-and-set!-use-of-x</span><span class="hspace"> </span><span class="RktSym">val</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="set_.html#%28form._%28%28quote._~23~25kernel%29._set%21%29%29" class="RktStxLink" data-pltdoc="x">set!</a></span><span class="hspace"> </span><span class="RktSym">bucket-1</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktSym">val</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="set_.html#%28form._%28%28quote._~23~25kernel%29._set%21%29%29" class="RktStxLink" data-pltdoc="x">set!</a></span><span class="hspace"> </span><span class="RktSym">bucket-2</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">1</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym">def-and-set!-use-of-x</span><span class="hspace"> </span><span class="RktVal">2</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktSym">x</span></td></tr><tr><td><p><span class="RktRes">1</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktSym">bucket-1</span></td></tr><tr><td><p><span class="RktRes">1</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktSym">bucket-2</span></td></tr><tr><td><p><span class="RktRes">2</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define-syntax%29%29" class="RktStxLink" data-pltdoc="x">define-syntax</a></span><span class="hspace"> </span><span class="RktSym">defs-and-uses/fail</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._syntax-rules%29%29" class="RktStxLink" data-pltdoc="x">syntax-rules</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">def-and-use</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">Initial reference to </span><span class="RktSym">even</span><span class="RktCmt"> precedes definition:</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">odd</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="if.html#%28form._%28%28quote._~23~25kernel%29._if%29%29" class="RktStxLink" data-pltdoc="x">if</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._zero~3f%29%29" class="RktValLink" data-pltdoc="x">zero?</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">even</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._sub1%29%29" class="RktValLink" data-pltdoc="x">sub1</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">even</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="if.html#%28form._%28%28quote._~23~25kernel%29._if%29%29" class="RktStxLink" data-pltdoc="x">if</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._zero~3f%29%29" class="RktValLink" data-pltdoc="x">zero?</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">odd</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._sub1%29%29" class="RktValLink" data-pltdoc="x">sub1</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">odd</span><span class="hspace"> </span><span class="RktVal">17</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym">defs-and-uses/fail</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktErr">even: undefined;</span></p></td></tr><tr><td><p><span class="RktErr"></span><span class="hspace"> </span><span class="RktErr">cannot reference undefined identifier</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define-syntax%29%29" class="RktStxLink" data-pltdoc="x">define-syntax</a></span><span class="hspace"> </span><span class="RktSym">defs-and-uses</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._syntax-rules%29%29" class="RktStxLink" data-pltdoc="x">syntax-rules</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktPn">(</span><span class="RktSym">def-and-use</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">Declare before definition via no-values </span><span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span><span class="RktCmt">:</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-syntaxes%29%29" class="RktStxLink" data-pltdoc="x">define-syntaxes</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">odd</span><span class="hspace"> </span><span class="RktSym">even</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="values.html#%28def._%28%28quote._~23~25kernel%29._values%29%29" class="RktValLink" data-pltdoc="x">values</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">odd</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="if.html#%28form._%28%28quote._~23~25kernel%29._if%29%29" class="RktStxLink" data-pltdoc="x">if</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._zero~3f%29%29" class="RktValLink" data-pltdoc="x">zero?</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">even</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._sub1%29%29" class="RktValLink" data-pltdoc="x">sub1</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">even</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="if.html#%28form._%28%28quote._~23~25kernel%29._if%29%29" class="RktStxLink" data-pltdoc="x">if</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="number-types.html#%28def._%28%28quote._~23~25kernel%29._zero~3f%29%29" class="RktValLink" data-pltdoc="x">zero?</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">#t</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">odd</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="generic-numbers.html#%28def._%28%28quote._~23~25kernel%29._sub1%29%29" class="RktValLink" data-pltdoc="x">sub1</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">odd</span><span class="hspace"> </span><span class="RktVal">17</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym">defs-and-uses</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">#t</span></p></td></tr></table></blockquote></td></tr></table></p><p>Macro-generated <span class="RktVal">"require"</span> and <span class="RktVal">"provide"</span>
clauses also introduce and reference generation-specific bindings:</p><ul><li><p>In <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span>, for a <span class="RktVar">require-spec</span> of the form
<span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._rename-in%29%29" class="RktStxLink" data-pltdoc="x">rename-in</a></span><span class="stt"> </span><span class="RktPn">[</span><span class="RktVar">orig-id</span><span class="stt"> </span><span class="RktVar">bind-id</span><span class="RktPn">]</span><span class="RktPn">)</span> or <span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._only-in%29%29" class="RktStxLink" data-pltdoc="x">only-in</a></span><span class="stt"> </span><span class="RktSym">....</span><span class="stt"> </span><span class="RktPn">[</span><span class="RktVar">orig-id</span><span class="stt"> </span><span class="RktVar">bind-id</span><span class="RktPn">]</span><span class="RktPn">)</span>, the <span class="RktVar">bind-id</span> is bound only for
uses of the identifier generated by the same macro expansion as
<span class="RktVar">bind-id</span>. In <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span> for other
<span class="RktVar">require-spec</span>s, the generator of the <span class="RktVar">require-spec</span>
determines the scope of the bindings.</p></li><li><p>In <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span>, for a <span class="RktVar">provide-spec</span> of the form
<span class="RktVar">id</span>, the exported identifier is the one that binds
<span class="RktVar">id</span> within the module in a generator-specific way, but the
external name is the plain <span class="RktVar">id</span>. The exceptions for
<span class="RktSym">all-except-out</span> are similarly determined in a
generator-specific way, as is the <span class="RktVar">orig-id</span> binding of a
<span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._rename-out%29%29" class="RktStxLink" data-pltdoc="x">rename-out</a></span> form, but plain identifiers are used for the
external names. For <span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._all-defined-out%29%29" class="RktStxLink" data-pltdoc="x">all-defined-out</a></span>, only identifiers with
definitions having the same generator as the
<span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._all-defined-out%29%29" class="RktStxLink" data-pltdoc="x">all-defined-out</a></span><span class="RktPn">)</span> form are exported; the external name is
the plain identifier from the definition.</p></li></ul><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""compilation-model"">1.2.4<tt> </tt><a name="(part._compilation-model)"></a>Compilation</h5><p>Before expanded code is evaluated, it is first <a name="(tech._compiled)"></a><span style="font-style: italic">compiled</span>. A
compiled form has essentially the same information as the
corresponding expanded form, though the internal representation
naturally dispenses with identifiers for syntactic forms and local
bindings. One significant difference is that a compiled form is almost
entirely opaque, so the information that it contains cannot be
accessed directly (which is why some identifiers can be dropped). At
the same time, a compiled form can be marshaled to and from a byte
string, so it is suitable for saving and re-loading code.</p><p>Although individual read, expand, compile, and evaluate operations are
available, the operations are often combined automatically. For
example, the <span class="RktSym"><a href="eval.html#%28def._%28%28quote._~23~25kernel%29._eval%29%29" class="RktValLink" data-pltdoc="x">eval</a></span> procedure takes a syntax object and expands
it, compiles it, and evaluates it.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""namespace-model"">1.2.5<tt> </tt><a name="(part._namespace-model)"></a>Namespaces</h5><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p><span class="imageleft"><img src="magnify.png" alt="+" width="24" height="24"/></span>See <a href="Namespaces.html" data-pltdoc="x">Namespaces</a> for functions that
manipulate namespaces.</p></blockquote></blockquote></blockquote><p>A <a name="(tech._namespace)"></a><span style="font-style: italic">namespace</span> is a top-level mapping from symbols to binding
information. It is the starting point for expanding an expression; a
<a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a> produced by <span class="RktSym"><a href="Reading.html#%28def._%28%28quote._~23~25kernel%29._read-syntax%29%29" class="RktValLink" data-pltdoc="x">read-syntax</a></span> has no initial
lexical context; the <a href="#%28tech._syntax._object%29" class="techoutside" data-pltdoc="x"><span class="techinside">syntax object</span></a> can be expanded after
initializing it with the mappings of a particular namespace. A
namespace is also the starting point evaluating expanded code, where
the first step in evaluation is linking the code to specific module
instances and top-level variables.</p><p>For expansion purposes, a namespace maps each symbol in each
<a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a> to one of three possible bindings:</p><ul><li><p>a particular <a href="#%28tech._module._binding%29" class="techoutside" data-pltdoc="x"><span class="techinside">module binding</span></a> from a particular module</p></li><li><p>a top-level transformer binding named by the symbol</p></li><li><p>a top-level variable named by the symbol</p></li></ul><p>An “empty” namespace maps all symbols to top-level variables.
Certain evaluations extend a namespace for future expansions;
importing a module into the top-level adjusts the namespace bindings
for all of the imported names, and evaluating a top-level
<span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span> form updates the namespace’s mapping to refer to a
variable (in addition to installing a value into the variable).</p><p>A namespace also has a <a name="(tech._module._registry)"></a><span style="font-style: italic">module registry</span> that maps module
names to module declarations (see <a href="eval-model.html#%28part._module-eval-model%29" data-pltdoc="x">Modules and Module-Level Variables</a>).
This registry is shared by all <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase level</span></a>s.</p><p>For evaluation, each namespace encapsulates a distinct set of
top-level variables at various <a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">phases</span></a>, as well as a potentially
distinct set of module instances in each <a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase</span></a>. That is, even
though module declarations are shared for all <a href="#%28tech._phase._level%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase levels</span></a>,
module instances are distinct for each <a href="eval-model.html#%28tech._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">phase</span></a>. Each namespace
has a <a name="(tech._base._phase)"></a><span style="font-style: italic">base phase</span>, which corresponds to the phase used by
reflective operations such as <span class="RktSym"><a href="eval.html#%28def._%28%28quote._~23~25kernel%29._eval%29%29" class="RktValLink" data-pltdoc="x">eval</a></span> and
<span class="RktSym"><a href="Module_Names_and_Loading.html#%28def._%28%28quote._~23~25kernel%29._dynamic-require%29%29" class="RktValLink" data-pltdoc="x">dynamic-require</a></span>. In particular, using <span class="RktSym"><a href="eval.html#%28def._%28%28quote._~23~25kernel%29._eval%29%29" class="RktValLink" data-pltdoc="x">eval</a></span> on a
<span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span> form <a href="eval-model.html#%28tech._instantiate%29" class="techoutside" data-pltdoc="x"><span class="techinside">instantiates</span></a> a module in the namespace’s
<a href="#%28tech._base._phase%29" class="techoutside" data-pltdoc="x"><span class="techinside">base phase</span></a>.</p><p>After a namespace is created, module instances from existing
namespaces can be attached to the new namespace. In terms of the
evaluation model, top-level variables from different namespaces
essentially correspond to definitions with different prefixes, but
attaching a module uses the same prefix for the module’s definitions
in namespaces where it is attached. The first step in evaluating any
compiled expression is to link its top-level variable and module-level
variable references to specific variables in the namespace.</p><p>At all times during evaluation, some namespace is designated as the
<a name="(tech._current._namespace)"></a><span style="font-style: italic">current namespace</span>. The current namespace has no particular
relationship, however, with the namespace that was used to expand the
code that is executing, or with the namespace that was used to link
the compiled form of the currently evaluating code. In particular,
changing the current namespace during evaluation does not change the
variables to which executing expressions refer. The current namespace
only determines the behavior of reflective operations to expand code
and to start evaluating expanded/compiled code.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">orig</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">define in the original namespace</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">The following </span><span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="RktCmt"> expression is compiled in the original</span></td></tr><tr><td><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">namespace, so direct references to </span><span class="RktSym">x</span><span class="RktCmt"> see </span><span class="RktVal">'</span><span class="RktVal">orig</span><span class="RktCmt">.</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">n</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="Namespaces.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._make-base-namespace%29%29" class="RktValLink" data-pltdoc="x">make-base-namespace</a></span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">make new namespace</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="parameters.html#%28form._%28%28lib._racket%2Fprivate%2Fmore-scheme..rkt%29._parameterize%29%29" class="RktStxLink" data-pltdoc="x">parameterize</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym"><a href="Namespaces.html#%28def._%28%28quote._~23~25kernel%29._current-namespace%29%29" class="RktValLink" data-pltdoc="x">current-namespace</a></span><span class="hspace"> </span><span class="RktSym">n</span><span class="RktPn">]</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="eval.html#%28def._%28%28quote._~23~25kernel%29._eval%29%29" class="RktValLink" data-pltdoc="x">eval</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">(</span><span class="RktVal">define</span><span class="hspace"> </span><span class="RktVal">x</span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">new</span><span class="RktVal">)</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">evals in the new namespace</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">displays </span><span class="RktVal">'</span><span class="RktVal">orig</span></td></tr><tr><td><span class="hspace"> </span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="Writing.html#%28def._%28%28quote._~23~25kernel%29._display%29%29" class="RktValLink" data-pltdoc="x">display</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="eval.html#%28def._%28%28quote._~23~25kernel%29._eval%29%29" class="RktValLink" data-pltdoc="x">eval</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">x</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktCmt">;</span><span class="RktCmt"> </span><span class="RktCmt">displays </span><span class="RktVal">'</span><span class="RktVal">new</span></td></tr></table></td></tr><tr><td><p><span class="RktOut">orignew</span></p></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr></table></blockquote></td></tr></table></p><p>A <a href="#%28tech._namespace%29" class="techoutside" data-pltdoc="x"><span class="techinside">namespace</span></a> is purely a top-level entity, not to be confused
with an <a href="#%28tech._environment%29" class="techoutside" data-pltdoc="x"><span class="techinside">environment</span></a>. In particular, a <a href="#%28tech._namespace%29" class="techoutside" data-pltdoc="x"><span class="techinside">namespace</span></a> does not
encapsulate the full <a href="#%28tech._environment%29" class="techoutside" data-pltdoc="x"><span class="techinside">environment</span></a> of an expression inside
local-binding forms.</p><p>If an <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> is bound to syntax or to an import, then
defining the <a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> as a <a href="eval-model.html#%28tech._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">variable</span></a> shadows the syntax
or import in future uses of the environment. Similarly, if an
<a href="#%28tech._identifier%29" class="techoutside" data-pltdoc="x"><span class="techinside">identifier</span></a> is bound to a <a href="eval-model.html#%28tech._top._level._variable%29" class="techoutside" data-pltdoc="x"><span class="techinside">top-level variable</span></a>, then
binding the identifier to syntax or an import shadows the variable;
the variable’s value remains unchanged, however, and may be accessible
through previously evaluated expressions.</p><p><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><p>Examples:</p></td></tr><tr><td><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">5</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">f</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktSym">x</span></td></tr><tr><td><p><span class="RktRes">5</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym">f</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">5</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define-syntax%29%29" class="RktStxLink" data-pltdoc="x">define-syntax</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29._syntax-id-rules%29%29" class="RktStxLink" data-pltdoc="x">syntax-id-rules</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">[</span><span class="RktSym"><a href="stx-patterns.html#%28form._%28%28lib._racket%2Fprivate%2Fstxcase-scheme..rkt%29.__%29%29" class="RktStxLink" data-pltdoc="x">_</a></span><span class="hspace"> </span><span class="RktVal">10</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktSym">x</span></td></tr><tr><td><p><span class="RktRes">10</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym">f</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">5</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">7</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktSym">x</span></td></tr><tr><td><p><span class="RktRes">7</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym">f</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">7</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29" class="RktStxLink" data-pltdoc="x">module</a></span><span class="hspace"> </span><span class="RktSym">m</span><span class="hspace"> </span><span class="RktSym">racket</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="hspace"> </span><span class="RktVal">8</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._provide%29%29" class="RktStxLink" data-pltdoc="x">provide</a></span><span class="hspace"> </span><span class="RktSym">x</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._require%29%29" class="RktStxLink" data-pltdoc="x">require</a></span><span class="hspace"> </span><span class="RktVal">'</span><span class="RktVal">m</span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0"><tr><td></td></tr></table></td></tr><tr><td><span class="stt">> </span><span class="RktSym">x</span></td></tr><tr><td><p><span class="RktRes">8</span></p></td></tr><tr><td><span class="stt">> </span><span class="RktPn">(</span><span class="RktSym">f</span><span class="RktPn">)</span></td></tr><tr><td><p><span class="RktRes">7</span></p></td></tr></table></blockquote></td></tr></table></p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""infernames"">1.2.6<tt> </tt><a name="(part._infernames)"></a>Inferred Value Names</h5><p>To improve error reporting, names are inferred at compile-time for
certain kinds of values, such as procedures. For example, evaluating
the following expression:</p><blockquote class="SCodeFlow"><p><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">f</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29" class="RktStxLink" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">0</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">f</span><span class="hspace"> </span><span class="RktVal">1</span><span class="hspace"> </span><span class="RktVal">2</span><span class="hspace"> </span><span class="RktVal">3</span><span class="RktPn">)</span><span class="RktPn">)</span></p></blockquote><p>produces an error message because too many arguments are provided to
the procedure. The error message is able to report <span class="RktSym">f</span> as
the name of the procedure. In this case, Racket decides, at
compile-time, to name as <span class="RktVal">'</span><span class="RktVal">f</span> all procedures created by the
<span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span>-bound <span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29" class="RktStxLink" data-pltdoc="x">lambda</a></span>.</p><p><div class="SIntrapara"><blockquote class="refpara"><blockquote class="refcolumn"><blockquote class="refcontent"><p><span class="imageleft"><img src="magnify.png" alt="+" width="24" height="24"/></span>See <span class="RktSym"><a href="procedures.html#%28def._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._procedure-rename%29%29" class="RktValLink" data-pltdoc="x">procedure-rename</a></span> to override a procedure’s
inferred name at runtime.</p></blockquote></blockquote></blockquote></div><div class="SIntrapara">Names are inferred whenever possible for procedures. Names closer to
an expression take precedence. For example, in</div></p><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._define%29%29" class="RktStxLink" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktSym">my-f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="let.html#%28form._%28%28lib._racket%2Fprivate%2Fletstx-scheme..rkt%29._let%29%29" class="RktStxLink" data-pltdoc="x">let</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">[</span><span class="RktSym">f</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._lambda%29%29" class="RktStxLink" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVal">0</span><span class="RktPn">)</span><span class="RktPn">]</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">f</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote><p>the procedure bound to <span class="RktSym">my-f</span> will have the inferred name
<span class="RktVal">'</span><span class="RktVal">f</span>.</p><p>When an <a name="(idx._(gentag._1._(lib._scribblings/reference/reference..scrbl)))"></a><span class="RktVal">'</span><span class="RktVal">inferred-name</span> property is attached to a
syntax object for an expression (see <a href="stxprops.html" data-pltdoc="x">Syntax Object Properties</a>), the
property value is used for naming the expression, and it overrides any
name that was inferred from the expression’s context. Normally, the
property value should be a symbol. A <span class="RktVal">'</span><span class="RktVal">inferred-name</span>
property value of <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=void_undefined.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="nobreak"><span class="RktRes">#<void></span></span></a> hides a name that would otherwise be
inferred from context (perhaps because a binding identifier’s was
automatically generated and should not be exposed).</p><p>When an inferred name is not available, but a source location is
available, a name is constructed using the source location
information. Inferred and property-assigned names are also available
to syntax transformers, via <span class="RktSym"><a href="stxtrans.html#%28def._%28%28quote._~23~25kernel%29._syntax-local-name%29%29" class="RktValLink" data-pltdoc="x">syntax-local-name</a></span>.</p><h5 x-source-module="(lib "scribblings/reference/reference.scrbl")" x-part-tag=""cross-phase persistent-grammar"">1.2.7<tt> </tt><a name="(part._cross-phase._persistent-grammar)"></a>Cross-Phase Persistent Module Declarations</h5><p>A module is <a href="eval-model.html#%28tech._cross._phase._persistent%29" class="techoutside" data-pltdoc="x"><span class="techinside">cross-phase persistent</span></a> only if it fits the following grammar,
which uses non-terminals from <a href="#%28part._fully-expanded%29" data-pltdoc="x">Fully Expanded Programs</a>, only if
it includes <span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._~23~25declare%29%29" class="RktStxLink" data-pltdoc="x">#%declare</a></span><span class="stt"> </span><span class="RktPn">#:cross-phase-persistent</span><span class="RktPn">)</span>, only
it includes no uses of <span class="RktSym"><a href="Syntax_Quoting__quote-syntax.html#%28form._%28%28quote._~23~25kernel%29._quote-syntax%29%29" class="RktStxLink" data-pltdoc="x">quote-syntax</a></span> or <span class="RktSym"><a href="Locations____variable-reference.html#%28form._%28%28quote._~23~25kernel%29._~23~25variable-reference%29%29" class="RktStxLink" data-pltdoc="x">#%variable-reference</a></span>,
and only if no module-level binding is <span class="RktSym"><a href="set_.html#%28form._%28%28quote._~23~25kernel%29._set%21%29%29" class="RktStxLink" data-pltdoc="x">set!</a></span>ed.</p><p><table cellspacing="0" cellpadding="0"><tr><td align="right" valign="baseline"><span class="hspace"> </span><span class="RktVar">cross-module</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._module%29%29" class="RktStxLink" data-pltdoc="x">module</a></span><span class="hspace"> </span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktVar">module-path</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-module-begin%29%29" class="RktStxLink" data-pltdoc="x">#%plain-module-begin</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">cross-form</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="hspace"> </span><span class="RktVar">cross-form</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="module.html#%28form._%28%28quote._~23~25kernel%29._~23~25declare%29%29" class="RktStxLink" data-pltdoc="x">#%declare</a></span><span class="hspace"> </span><span class="RktPn">#:cross-phase-persistent</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="begin.html#%28form._%28%28quote._~23~25kernel%29._begin%29%29" class="RktStxLink" data-pltdoc="x">begin</a></span><span class="hspace"> </span><span class="RktVar">cross-form</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28quote._~23~25kernel%29._~23~25provide%29%29" class="RktStxLink" data-pltdoc="x">#%provide</a></span><span class="hspace"> </span><span class="RktVar">raw-provide-spec</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">submodule-form</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="define.html#%28form._%28%28quote._~23~25kernel%29._define-values%29%29" class="RktStxLink" data-pltdoc="x">define-values</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">id</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktVar">cross-expr</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="require.html#%28form._%28%28quote._~23~25kernel%29._~23~25require%29%29" class="RktStxLink" data-pltdoc="x">#%require</a></span><span class="hspace"> </span><span class="RktVar">raw-require-spec</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="hspace"> </span><span class="RktVar">cross-expr</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">id</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="quote.html#%28form._%28%28quote._~23~25kernel%29._quote%29%29" class="RktStxLink" data-pltdoc="x">quote</a></span><span class="hspace"> </span><span class="RktVar">cross-datum</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-lambda%29%29" class="RktStxLink" data-pltdoc="x">#%plain-lambda</a></span><span class="hspace"> </span><span class="RktVar">formals</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktSym">...+</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="lambda.html#%28form._%28%28quote._~23~25kernel%29._case-lambda%29%29" class="RktStxLink" data-pltdoc="x">case-lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktVar">formals</span><span class="hspace"> </span><span class="RktVar">expr</span><span class="hspace"> </span><span class="RktSym">...+</span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktSym">...</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="application.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-app%29%29" class="RktStxLink" data-pltdoc="x">#%plain-app</a></span><span class="hspace"> </span><span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._cons%29%29" class="RktValLink" data-pltdoc="x">cons</a></span><span class="hspace"> </span><span class="RktVar">cross-expr</span><span class="hspace"> </span><span class="RktSym">...+</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="application.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-app%29%29" class="RktStxLink" data-pltdoc="x">#%plain-app</a></span><span class="hspace"> </span><span class="RktSym"><a href="pairs.html#%28def._%28%28quote._~23~25kernel%29._list%29%29" class="RktValLink" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVar">cross-expr</span><span class="hspace"> </span><span class="RktSym">...+</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="application.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-app%29%29" class="RktStxLink" data-pltdoc="x">#%plain-app</a></span><span class="hspace"> </span><span class="RktSym"><a href="creatingmorestructs.html#%28def._%28%28quote._~23~25kernel%29._make-struct-type%29%29" class="RktValLink" data-pltdoc="x">make-struct-type</a></span><span class="hspace"> </span><span class="RktVar">cross-expr</span><span class="hspace"> </span><span class="RktSym">...+</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="application.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-app%29%29" class="RktStxLink" data-pltdoc="x">#%plain-app</a></span><span class="hspace"> </span><span class="RktSym"><a href="structprops.html#%28def._%28%28quote._~23~25kernel%29._make-struct-type-property%29%29" class="RktValLink" data-pltdoc="x">make-struct-type-property</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">cross-expr</span><span class="hspace"> </span><span class="RktSym">...+</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="application.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-app%29%29" class="RktStxLink" data-pltdoc="x">#%plain-app</a></span><span class="hspace"> </span><span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._gensym%29%29" class="RktValLink" data-pltdoc="x">gensym</a></span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="application.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-app%29%29" class="RktStxLink" data-pltdoc="x">#%plain-app</a></span><span class="hspace"> </span><span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._gensym%29%29" class="RktValLink" data-pltdoc="x">gensym</a></span><span class="hspace"> </span><span class="RktVar">string</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktPn">(</span><span class="RktSym"><a href="application.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-app%29%29" class="RktStxLink" data-pltdoc="x">#%plain-app</a></span><span class="hspace"> </span><span class="RktSym"><a href="symbols.html#%28def._%28%28quote._~23~25kernel%29._string-~3euninterned-symbol%29%29" class="RktValLink" data-pltdoc="x">string->uninterned-symbol</a></span><span class="hspace"> </span><span class="RktVar">string</span><span class="RktPn">)</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td></tr><tr><td align="right" valign="baseline"><span class="hspace"> </span><span class="RktVar">cross-datum</span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">=</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">number</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">boolean</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">identifier</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">string</span></td></tr><tr><td align="right" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="center" valign="baseline">|</td><td align="left" valign="baseline"><span class="stt"> </span></td><td align="left" valign="baseline"><span class="RktVar">bytes</span></td></tr></table></p><p>This grammar applies after <a href="#%28tech._expansion%29" class="techoutside" data-pltdoc="x"><span class="techinside">expansion</span></a>, but because a <a href="eval-model.html#%28tech._cross._phase._persistent%29" class="techoutside" data-pltdoc="x"><span class="techinside">cross-phase persistent</span></a>
module imports only from other cross-phase persistent modules, the only relevant
expansion steps are the implicit introduction of
<span class="RktSym"><a href="module.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-module-begin%29%29" class="RktStxLink" data-pltdoc="x">#%plain-module-begin</a></span>, implicit introduction of <span class="RktSym"><a href="application.html#%28form._%28%28lib._racket%2Fprivate%2Fbase..rkt%29._~23~25plain-app%29%29" class="RktStxLink" data-pltdoc="x">#%plain-app</a></span>,
and implicit introduction and/or expansion of <span class="RktSym"><a href="quote.html#%28form._%28%28quote._~23~25kernel%29._~23~25datum%29%29" class="RktStxLink" data-pltdoc="x">#%datum</a></span>.</p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="eval-model.html" title="backward to "1.1 Evaluation Model"" data-pltdoc="x">← prev</a> <a href="model.html" title="up to "1 Language Model"" data-pltdoc="x">up</a> <a href="reader.html" title="forward to "1.3 The Reader"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|