Re: (sxhash (make-instance 'ext:standard-stablehash)) => 3614431684

Bruno Haible <[email protected]> Sat, 13 Jan 2018 06:21:44 +0100
Newsgroups gmane.lisp.clisp.devel
Message-ID <2105565.po2fEzRt9n@omega>
Hello Pascal,

> > Yes, it is conceivable that SXHASH looks into instances of
> > STANDARD-OBJECT or STRUCTURE-OBJECT, with a limited depth.
> 
> I don’t agree.

Indeed, it seems I misread the spec [1] today (and read it correctly
when I implemented SXHASH).

> Furthermore, it means that the SXHASH shouldn’t change when you mutate the slots of the object!

Indeed, that is implied by clause 3.

> IMO, SXHASH for object shall depend only on the identity of the object.

Yes, and by clause 2, applied to a cons such as
  (#<STANDARD-OBJECT #x000333F08090>)
, the value that we compute in sxhash_atom must also not depend on the address
of the STANDARD-OBJECT or STRUCTURE-OBJECT in memory.

But the function sxhash, used outside of hashcode_tree recursion, could
use the address of the object. Clause 2 does not apply to instances of
STANDARD-OBJECT or STRUCTURE-OBJECT.

Thanks for having corrected me!

Bruno

[1] http://www.ai.mit.edu/projects/iiip/doc/CommonLISP/HyperSpec/Body/fun_sxhash.html


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel