bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#58338: 29.0.50; mapatoms called on more elements than in obarray?


From: Stefan Kangas
Subject: bug#58338: 29.0.50; mapatoms called on more elements than in obarray?
Date: Thu, 6 Oct 2022 13:04:27 -0500

Philip Kaludercic <philipk@posteo.net> writes:

> From reading the docstring of `mapatoms', I would assume that this would
> evaluate to t:
>
> (let ((i 0))
>   (mapatoms (lambda (_) (setq i (1+ i))) obarray)
>   (= (length obarray) i))
>
> But instead on my system I get (length obarray) ↝ 15121 and and i ↝
> 78050, which is are at a ratio of 5.16169565505.
>
> Also interesting, if I intern a variable "foo", the value of i increases
> to 83106, while (length obarray) stays the same (?)

In my current long running Emacs session, I'm getting:

    15121 119188

Using emacs -Q on 29.0.50:

   15121 17228

Using emacs -Q on 27.1:

   15121 15880

> Interestingly enough, I'd expect this to at least output a single
> message:
>
> (let ((ht (make-hash-table)))
>   (mapatoms (lambda (s) (cl-incf (gethash s ht 0))))
>   (maphash (lambda (sym i)
>            (when (> i 1)
>              (message "%S: %d" sym i)))
>          ht))
>
> but apparently no symbol is invoked twice.  Not even by name
>
> (let ((ht (make-hash-table :test #'equal)))
>   (mapatoms (lambda (s) (cl-incf (gethash (symbol-name s) ht 0))))
>   (maphash (lambda (sym i)
>            (when (> i 1)
>              (message "%S: %d" sym i)))
>          ht))

Same results in Emacs 27.1.

> Is this perhaps related to symbol positions?  I don't quite understand
> bare symbols yet, but it doesn't appear to change anything if I check

It seems like this might be older than bare symbols.





reply via email to

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