[plt-scheme] identifier binding to undefined identifier

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Mon Nov 3 10:51:13 EST 2008

At Sun, 02 Nov 2008 16:40:53 -0700, Jon Rafkind wrote:
> The docs say identifier-binding returns #f is the binding is a top-level 
> binding but what if there is no binding at all?

That's the same as having a top-level variable binding. The docs need
some work on this point.

> What is the rationale for this? It seems more logical to return 
> 'top-level if the identifier is bound at the top-level.

Conflating "unbound" and "bound at the top level" makes REPLs work.
That is, outside of a module, there's is really no such thing as
"unbound", so in a REPL you can write

  > (define (f) (g))
  > (define (g) (f))

and then `(g)' is an infinite loop. As of first interaction, the body
of the function `f' has a meaning because `g' is "bound", even though
`g' is not yet "defined".

Within a module, there's no such thing as "bound at the top level", so
identifiers with no other binding within a module are described as
"unbound".


Matthew



Posted on the users mailing list.