[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: lengths and other stuff
From: |
Tomas Hlavaty |
Subject: |
Re: lengths and other stuff |
Date: |
Mon, 28 Dec 2020 00:25:32 +0100 |
On Sun 27 Dec 2020 at 15:05, Daniel Brooks <db48x@db48x.net> wrote:
> Some of them can no doubt be replaced by multiple-value-bind and other
> such things. This one from ido.el:1518, for example:
>
> (if (and (listp (car l))
> (> (length (car l)) 2)
> (let ((dir (car (car l)))
> (time (car (cdr (car l))))
> (files (cdr (cdr (car l)))))
>
> could be (multiple-value-bind (dir time files) (car l) …).
>
> But those kinds of improvements take a lot more thought about each
> occurrence.
Very good. Now the other ~1700 cases.
I think you introduced two bugs:
1) missing &rest, it should be:
(multiple-value-bind (dir time &rest files) (car l) …)
2) multiple-value-bind throws an error if it does not fit. The original
code does not seem to throw an error.
But all this excercise for single case took mental effort, got it wrong
and the change would need to be carefully undertaken.
The point of the predicates is to avoid such rewrites and improve the
code simply by search, replace and visual substitution without thinking
hard and introducing bugs.
- Re: Internationalize Emacs's messages (swahili), (continued)
- Re: Internationalize Emacs's messages (swahili), Tomas Hlavaty, 2020/12/27
- lengths and other stuff, Daniel Brooks, 2020/12/27
- Re: lengths and other stuff, Lars Ingebrigtsen, 2020/12/27
- Re: lengths and other stuff, Daniel Brooks, 2020/12/27
- Re: lengths and other stuff, Lars Ingebrigtsen, 2020/12/27
- Re: lengths and other stuff, Daniel Brooks, 2020/12/27
- Re: lengths and other stuff, Stefan Monnier, 2020/12/27
- Re: lengths and other stuff, Stefan Monnier, 2020/12/27
- Re: lengths and other stuff, Daniel Brooks, 2020/12/27
- Re: lengths and other stuff, Stefan Monnier, 2020/12/27
- Re: lengths and other stuff,
Tomas Hlavaty <=
- Re: lengths and other stuff, Daniel Brooks, 2020/12/27
- Re: lengths and other stuff, Tomas Hlavaty, 2020/12/27
- Re: lengths and other stuff, Daniel Brooks, 2020/12/27
- Re: Internationalize Emacs's messages (swahili), Alfred M. Szmidt, 2020/12/27
- Re: Internationalize Emacs's messages (swahili), Tomas Hlavaty, 2020/12/27
- Re: Internationalize Emacs's messages (swahili), Alfred M. Szmidt, 2020/12/27
- Re: Internationalize Emacs's messages (swahili), Tomas Hlavaty, 2020/12/27
- Re: Internationalize Emacs's messages (swahili), Lars Ingebrigtsen, 2020/12/27
- RE: Internationalize Emacs's messages (swahili), Drew Adams, 2020/12/28
- Re: Internationalize Emacs's messages (swahili), Alfred M. Szmidt, 2020/12/27