unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@igalia.com>
To: "Ludovic Courtès" <ludo@gnu.org>
Cc: 39634@debbugs.gnu.org, Rob Browning <rlb@defaultvalue.org>
Subject: bug#39634: All keyowrds hash to the same value
Date: Tue, 25 Feb 2020 21:56:56 +0100	[thread overview]
Message-ID: <87h7zeo06f.fsf@igalia.com> (raw)
In-Reply-To: <875zg19qpl.fsf@gnu.org> ("Ludovic \=\?utf-8\?Q\?Court\=C3\=A8s\=22'\?\= \=\?utf-8\?Q\?s\?\= message of "Thu, 20 Feb 2020 17:19:18 +0100")

On Thu 20 Feb 2020 17:19, Ludovic Courtès <ludo@gnu.org> writes:

> Of all the scm_tc7_ values listed in ‘scm.h’, the following are not
> explicitly listed (so they go to the default case that hashes the first
> word):

Reformatting your list so I can check one by one :)

>   variable,
>   hashtable,
>   fluid,
>   dynamic_state,
>   frame,
>   atomic_box,
>   program,
>   vm_cont,
>   weak_set,
>   weak_table,
>   port

No equal? implementation, so should hashq() instead.

>   bytevector,
>   array,
>   bitvector,

These have equal? implementations, and what's more, a bitvector can
equal? an array... I think we have another bug!

  ;; Project 2d array as 1d array (scm_tc7_array)
  (define x
    (make-shared-array #2b((#t #t #t)) (lambda (i) (list 0 i)) '(0 2)))
  ;; scm_tc7_bitvector
  (define y #*111)

  (equal? x y) ;; => #t
  (equal? (hash x #xffffffff) (hash y #xffffffff)) ;; => #f
            
Similarly for 1-d scm_tc7_array versus regular vectors, bytevectors,
etc.

Fixing this will not be straightforward...  I think basically 1d arrays
need some special hashing logic so that e.g. vectors and 1d arrays hash
to the same thing.

>   stringbuf,
>   values,

These are never exposed to Scheme, and never compared using equal?
AFAIU.  No need for special cases.

Basically I think the tc7 case should default to hashq, and include
special cases for the ones that have equal? implementations or which
have read syntax.

Sound right to you?

Andy





  reply	other threads:[~2020-02-25 20:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-16 18:20 bug#39634: All keyowrds hash to the same value Rob Browning
2020-02-20 16:19 ` Ludovic Courtès
2020-02-25 20:56   ` Andy Wingo [this message]
2020-02-25 22:13     ` lloda
2020-02-26 21:02     ` Ludovic Courtès
2020-03-06 14:42     ` Ludovic Courtès
2020-03-06 15:43       ` Andy Wingo
2020-03-06 16:19         ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87h7zeo06f.fsf@igalia.com \
    --to=wingo@igalia.com \
    --cc=39634@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    --cc=rlb@defaultvalue.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).