[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
constant folding/smashing (constant hash tables)
> From: email@example.com (Jon L White)
> Subject: constant folding/smashing
> re: What about constant hash-tables? No variety of QUOTE can build
> a constant hash table because there is no notation for them.
> (I don't count #.(make-hash-table...) because it's so gross.)
> There is a proposal before X3J13 now (presented by Dave Touretzky) to
> give a printable representation to hashtables. If a sufficiently powerful
> version of it is adopted, then it should be possible to use QUOTE to
> reference a constant hashtable.
There is already a way to make a constant hashtable with QUOTE. Try:
(defmacro make-a-constant-hash-table ()
`(quote ,(make-hash-table ...)))
This same trick can also be used to make "constants" out of other kinds
of weird objects, like packages or streams.