GNU bug report logs - #59328
29.0.50; `seq-keep' implementation only valid for lists

Previous Next

Package: emacs;

Reported by: Michael Heerdegen <michael_heerdegen <at> web.de>

Date: Thu, 17 Nov 2022 02:19:02 UTC

Severity: wishlist

Found in version 29.0.50

Full log


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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Michael Heerdegen <michael_heerdegen <at> web.de>
Cc: larsi <at> gnus.org, jonas <at> bernoul.li, 59328 <at> debbugs.gnu.org
Subject: Re: bug#59328: 29.0.50; `seq-keep' implementation only valid for lists
Date: Fri, 25 Nov 2022 13:55:34 +0200
> From: Michael Heerdegen <michael_heerdegen <at> web.de>
> Cc: 59328 <at> debbugs.gnu.org,  larsi <at> gnus.org,  jonas <at> bernoul.li
> Date: Fri, 25 Nov 2022 10:47:31 +0100
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> 
> > Can tests for this be written in a way that they are only run if the
> > relevant packages are available on the user's system?  If so, I'd
> > prefer to have that than no tests at all.
> 
> I don't know.

AFAIK, 'require' can return nil if asked not to error out.

> Alternatively we could implement `seq-map' for an ad-hoc defined
> sequence type and test using that type, e.g. this expression:
> 
> #+begin_src emacs-lisp
> (progn
>   (defvar gensym)
>   (let ((gensym (make-symbol "foo")))
>     (eval `(cl-defmethod seq-map (function (thing (head ,gensym)))
>              (append (list (car thing) (cadr thing)) (seq-map function (cddr thing))))
>           t)
>     (equal (list gensym nil 4 46)
>            (seq-keep (lambda (x) (and (integerp x) (* 2 x)))
>                      (list gensym nil 2 'x gensym 23)))))
> #+end_src
> 
> returns t with my patch installed and nil else and works without relying
> on something external.  I'm not sure if defining methods (for seq-map in
> this case) that are globally visible is allowed in tests, so I
> implemented the example above in a way that the change of the generic
> function is not visible from the outside (thus the "secret" gensym).
> 
> Would something like that be acceptable?
> 
> Sorry for my ignorance, I didn't write much tests before.

Sounds like over-engineering to me.

Like I said: it's your call.  If you see too many complications to adding a
test, and my suggestions don't convince you, I won't object to installing
your original proposal without a test.

Thanks.




This bug report was last modified 125 days ago.

Previous Next


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