Re: 4.0.0 problem with using symbols as hash table keys

From: Harvey J. Stein <hjstein_at_bfr.co.il>
Date: 13 Sep 1999 17:00:51 -0400

Erick Gallesio <Erick.Gallesio_at_unice.fr> writes:

> Jonathan Berry writes:
> > 4.0.0 looks promising, but I can't use it yet. My application is defeated
> > by the following behavior: a variable whose value is a symbol generated
> > by gensym can be used to look up a hash value, but the symbol itself
> > cannot. This was not a problem in any of the previous versions of STk.
> > Here's an example:
>
> As replied Shiro, actual behavior is "better behavior, because the symbol
> returned by gensym is not interned so that it can't be eq? to
> the symbols with the same name." This is the Right Thing to do IMHO
> for the system gensym.

But that doesn't explain why his code doesn't work when equal? is used
as the hash table equality function:


   STk> (define h (make-hash-table equal?))
   h
   STk> (define k (gensym "abc"))
   k
   STk> k
   abc3
   STk> (hash-table-put! h k 1)
   STk> (equal? k 'abc3)
   #t
   STk> (hash-table-get h k)
   1
   STk> (hash-table-get h 'abc3)

   *** Error:
   hash-table-get: entry not defined for this key: abc3
   STk>

-- 
Harvey Stein
Bloomberg LP
hjstein_at_bfr.co.il
Received on Mon Sep 13 1999 - 23:03:55 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST