Hi all,<br><br>I&#39;ve found needs to track variables/values that I&#39;ve instantiated to aid meta programming, and hash-table seems to work well for this purpose.&nbsp; Below is a sample for motivation.<br><br>;;; the struct that holds the metadata info 
<br>(define-struct type (name isa? cast) (make-inspector))<br><br>;;; have a register to keep track of the types <br>(define-values (type:register type:get) <br>&nbsp; (let ((register (make-hash-table &#39;equal)))<br>&nbsp;&nbsp;&nbsp; (define (type:register key value)
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (hash-table-put! register key value))<br>&nbsp;&nbsp;&nbsp; (define (type:get key)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (hash-table-get register key #f))))<br><br>;;; macro to wrap around the definition + registration<br>(define-syntax define-type<br>&nbsp; (syntax-rules (isa? cast)
<br>&nbsp;&nbsp;&nbsp; ((_ name (isa? isa?-exp) (cast cast-exp))<br>&nbsp;&nbsp;&nbsp;&nbsp; (define name <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (let ((t (make-type &#39;name isa?-exp cast-exp)))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (foo:register &#39;name t)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t)))))<br><br>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&#39;t obey lexical rules.
<br><br>Are there ways to make it obey lexical rules so the register can behave more like an actual symbol table?&nbsp; i.e. if a type is declared within a lexical scope as it goes out of scope the value is removed from the register.&nbsp; I assume that if this is possible there needs to be a way to know that I&#39;m in a different lexical scope then before.
<br><br>Any thoughts are appreciated - thanks.<br><br>yc<br><br><br>