Re: rnrs records: shadows previous definition of `dummy-1a78708d3c9406a3'

Olivier Dion <[email protected]> Sat, 23 May 2026 12:25:18 -0400
Newsgroups gmane.lisp.guile.devel,gmane.lisp.guile.user
Message-ID <87cxymw0sx.fsf@laura>
On Sat, 23 May 2026, Ludovic Court=C3=A8s <[email protected]> wrote:
> Hello,
>
> Olivier Dion <[email protected]> skribis:
>
>>   scheme@(guile-user)> (=3D (hash '(1 2 3 4 5) most-positive-fixnum)
>>                           (hash '(1 2 3 4 5 6) most-positive-fixnum))
>>     =3D> #t
>>
>> To me this screams that list hashing are fundamentally broken.  Only the
>> first 5 elements are used for hashing.  This is why you got the same
>> hash for both transformations.
>
> One of the design goals for =E2=80=98hash=E2=80=99 is that it must be con=
stant-time.

I don't think this hold true for other types like string.

> Thus, by definition, it cannot traverse entire lists or vectors.

I think the `depth' logic is more to handle cycles in containers.  I
also don't quite understand why the depth is divided by two when
traversing a flat list/vector.  To me the depth should be incremented
when going down into a sub-container, not when getting the next element.
However, I would need to read the git history to understand the
rationale fully.

> I don=E2=80=99t see how to avoid that.

If we can't avoid this, e.g. we want to keep the constant-time behavior,
then we should at least document that limitation in the manual and
recommend some alternative to users.

Also, I think that psyntax should maybe do it's own recursive traversal
of the form for hashing.  That would avoid the issue that Tomas
mentionned with duplicated top-level identifiers.

Thanks,
Olivier
--=20
Olivier Dion