racket/collects/syntax/scribblings/free-vars.scrbl
Matthew Flatt 0197902309 add var-ref->mod-decl-insp' and switch cur-code-insp' uses
Macros and other tools that need syntax privilege used
`(current-code-inspector)' at the module top-level to try to
capture the right code inspector at load time. It's more
consistent to instead use the enclosing module's declaration-time
inspector, and `var-ref->mod-decl-insp' provides that. The
new function works only on references to anonymous variables,
which limits access to the inspector.

The real function name is longer, of course.
2011-09-20 13:50:36 -06:00

20 lines
710 B
Racket

#lang scribble/doc
@(require "common.rkt" (for-label syntax/free-vars))
@title[#:tag "free-vars"]{Computing the Free Variables of an Expression}
@defmodule[syntax/free-vars]
@defproc[(free-vars [expr-stx syntax?] [insp inspector? _mod-decl-insp])
(listof identifier?)]{
Returns a list of free @racket[lambda]- and @racket[let]-bound
identifiers in @racket[expr-stx]. The expression must be fully
expanded (see @secref[#:doc refman "fully-expanded"] and
@racket[expand]).
The inspector @racket[insp] is used to disarm @racket[expr-stx] and
sub-expressions before extracting idenrifiers. The default
@racket[insp] is the declaration-time inspector of the
@racketmodname[syntax/free-vars] module.}