bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hashx -set! and -ref


From: Neil Jerram
Subject: Re: hashx -set! and -ref
Date: Mon, 14 Jan 2008 21:58:09 +0000
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.4 (gnu/linux)

Gregory Marton <address@hidden> writes:

> I may be misunderstanding something, but I thought this should yield 'bar:
>
> guile> (let ((ht (make-hash-table)))
>          (hashx-set! (lambda (k s) 1) equal? ht 'foo 'bar)
>          (hashx-ref (lambda (k s) 1) equal? ht 'foo))
>
> #f

The second arg to hashx-set! and hashx-ref is supposed to be like
assoc/assq/assv, not equal?/eqv?/eq?.  So...

guile> (let ((ht (make-hash-table)))
         (hashx-set! (lambda (k s) 1) assoc ht 'foo 'bar)
         (hashx-ref (lambda (k s) 1) assoc ht 'foo))
bar


> I thought perhaps the problem was with the equality test somehow, but
> then even worse:
> guile> (let ((ht (make-hash-table)))
>          (hashx-set! (lambda (k s) 1) (lambda (a b) #t) ht 'foo 'bar)
>          (hashx-ref (lambda (k s) 1) (lambda (a b) #t) ht 'foo))
>
> Bus error

That definitely shouldn't happen, though.  Would you mind raising this
as a bug at Guile's Savannah project, for ease of tracking, and attach
the test patch that reproduces it (for which many thanks!).

Regards,
        Neil





reply via email to

[Prev in Thread] Current Thread [Next in Thread]