[plt-scheme] track symbols and respecting the lexical environment

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Aug 15 07:18:19 EDT 2007

At Wed, 15 Aug 2007 01:23:01 -0700, YC wrote:
> Of course - any data stored in a hash table would live until the hash table
> goes out of scope or until the data gets overwritten, and it doesn't obey
> lexical rules.
> 
> Are there ways to make it obey lexical rules so the register can behave more
> like an actual symbol table?  i.e. if a type is declared within a lexical
> scope as it goes out of scope the value is removed from the register.  I
> assume that if this is possible there needs to be a way to know that I'm in
> a different lexical scope then before.

See `make-bound-identifier-mapping'.

There's no way for bindings to get dropped from the table, but scope
should work out right. Also, when compiling modules, a fresh module
instantiation for each expand/compile will effectively clear the table
each time you expand/compile a module.

Matthew



Posted on the users mailing list.