GNU bug report logs - #29489
Obsolete gnus-remove-if and gnus-remove-if-not

Previous Next

Packages: gnus, emacs;

Reported by: Eric Abrahamsen <eric <at> ericabrahamsen.net>

Date: Tue, 28 Nov 2017 17:03:05 UTC

Severity: normal

Tags: patch

Found in version 5.13

Done: Eric Abrahamsen <eric <at> ericabrahamsen.net>

Bug is archived. No further changes may be made.

Full log


Message #25 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Eric Abrahamsen <eric <at> ericabrahamsen.net>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#29489: Obsolete gnus-remove-if and gnus-remove-if-not
Date: Tue, 28 Nov 2017 17:42:08 -0800
Noam Postavsky <npostavs <at> users.sourceforge.net> writes:

> Eric Abrahamsen <eric <at> ericabrahamsen.net> writes:
>
>>> Although the docstring claims "hash table", while the code says...
>>>
>>>> -    (if hash-table-p
>>>> -	(mapatoms (lambda (symbol)
>>>> -		    (unless (funcall predicate symbol)
>>>> -		      (push symbol out)))
>>>> -		  sequence)
>>>
>>> obarray?
>>
>> Shhh, that's my next patch to Gnus! Turning its "hash tables" into
>> actual hash tables. The obarrays are an impressive and horrible hack.
>>
>> For this version of the patch, `seq-filter' works on vectors. In the
>> next patch, it's replaced by seq-filter->map-keys.
>
> Hmm, seq-filter works on vectors, but it's not reliable for obarrays:
>
>     (let ((list nil)
>           (ob (make-vector 3 0)))
>       (intern "foo" ob)
>       (intern "bar" ob)
>       (intern "xxx" ob)
>       (seq-filter (lambda (_) t) ob)) ;=> (xxx 0 0)

For the interim, all that matters is consistency:

(let ((list nil)
      (ob (make-vector 3 0)))
  (intern "foo" ob)
  (intern "bar" ob)
  (intern "xxx" ob)
  (gnus-remove-if-not (lambda (_) t) ob)) ;=> (xxx 0 0)

The goal of this patch series is to get Gnus into a state where behavior
is at-a-glance comprehensible.





This bug report was last modified 7 years and 168 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.