Re: 4.0.0 problem with using symbols as hash table keys

From: Erick Gallesio <Erick.Gallesio_at_unice.fr>
Date: Tue, 14 Sep 1999 11:23:10 +0200 (CEST)

Harvey J. Stein writes:
> 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>

Ooops, I have not read enough Jonathan mail. That's true that it
should not have this problem. In fact I used the address of a symbol
in hash table code rather than it's constituting characters. Of
course, with uninterned symbols if doesn't work anymore. I have
corrected that.

BTW, I have a sufficient number of corrections and I plan to release a
4.0.1 in a few days to correct all this problems.


                -- Erick
Received on Tue Sep 14 1999 - 14:36:08 CEST

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