emacs-devel
[Top][All Lists]
Advanced

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

Re: hash-table-{to, from}-alist


From: Stefan Monnier
Subject: Re: hash-table-{to, from}-alist
Date: Tue, 25 Nov 2008 20:46:23 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

>         #s<hash-table size 65 test 'eql weak 'key rehash-size 20.0 
> rehash-threshold 0.001 data (1 2 5 env )>

Looks OK, except I don't think it's a good idea to include ' in front of
key and eql.  I know it's what we do right now, but in order to read it
back in, it's going to be more trouble.  Also I'd generally prefer using
":weakness" rather than "weak", so it's as close as possible to the key
args passed to make-hash-table.

> I know it's broken for circular references (e.g. (puthash 6 h h)
> above).  How should I handle that?

The same way as the other circularities.  I.e. it should mostly "just
work", except you'll have to change the code that does the first pass so
that it doesn't skip hash tables.

> +       if (SYMBOLP (h->test))
> +         {
> +               strout (" test '", -1, -1, printcharfun, 0);
> +               print_object (h->test, printcharfun, 0);
> +             }

Shouldn't it be !NILP (h->test) rather than SYMBOLP (h->test)?

> +       if (SYMBOLP (h->weak) && ! NILP(h->weak))
> +         {
> +               strout (" weak '", -1, -1, printcharfun, 0);
> +               print_object (h->weak, printcharfun, 0);
> +             }

Here as well, !NILP should be sufficient.

> +       if (FLOATP (h->rehash_size) || INTEGERP (h->rehash_size))
> +         {
> +               strout (" rehash-size ", -1, -1, printcharfun, 0);
> +               print_object (h->rehash_size, printcharfun, 0);
> +             }

And again !NILP sounds preferable.

Otherwise, it looks OK,


        Stefan




reply via email to

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