A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.racket-lang.org/reference/Expanding_Top-Level_Forms.html below:

12.9 Expanding Top-Level Forms

12.9 Expanding Top-Level Forms🔗ℹ

Expands all non-primitive syntax in

top-level-form

, and returns a syntax object for the expanded form that contains only core forms, matching the grammar specified by

Fully Expanded Programs

.

Before top-level-form is expanded, its lexical context is enriched with namespace-syntax-introduce, just as for eval. Use syntax->datum to convert the returned syntax object into a printable datum.

If insp is not the original code inspector (i.e., the value of (current-code-inspector) when Racket starts), then the result syntax object is tainted.

Here’s an example of using expand on a module:

Here’s an example of using expand on a non-top-level form:

Changed in version 8.2.0.4 of package base: Added the insp argument and tainting.

Like

(expand stx insp)

, except that the argument must be a

syntax object

, and its lexical context is not enriched before expansion.

Changed in version 8.2.0.4 of package base: Added the insp argument and tainting.

Partially expands

top-level-form

and returns a syntax object for the partially-expanded expression. Due to limitations in the expansion mechanism, some context information may be lost. In particular, calling

expand-once

on the result may produce a result that is different from expansion via

expand

.

Before top-level-form is expanded, its lexical context is enriched with namespace-syntax-introduce, as for eval.

The insp argument determines whether the result is tainted, the same as for expand.

Changed in version 8.2.0.4 of package base: Added the insp argument and tainting.

Like

(expand-once stx)

, except that the argument must be a

syntax object

, and its lexical context is not enriched before expansion.

Changed in version 8.2.0.4 of package base: Added the insp argument and tainting.

Partially expands

top-level-form

to reveal the outermost syntactic form. This partial expansion is mainly useful for detecting top-level uses of

begin

. Unlike the result of

expand-once

, expanding the result of

expand-to-top-form

with

expand

produces the same result as using

expand

on the original syntax.

Before stx-or-sexpr is expanded, its lexical context is enriched with namespace-syntax-introduce, as for eval.

The insp argument determines whether the result is tainted, the same as for expand.

Changed in version 8.2.0.4 of package base: Added the insp argument and tainting.

Changed in version 8.2.0.4 of package base: Added the insp argument and tainting.

12.9.1 Information on Expanded Modules🔗ℹ

Information for an expanded module declaration is stored in a set of syntax properties (see Syntax Object Properties) attached to the syntax object:

Changed in version 7.0 of package base: Removed 'module-variable-provides, 'module-syntax-provides, 'module-indirect-provides, and 'module-indirect-for-meta-provides properties.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4