[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Advantage using mapc over dolist
From: |
Stefan Monnier |
Subject: |
Re: Advantage using mapc over dolist |
Date: |
Tue, 03 Dec 2024 18:29:06 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
>> Richard was strongly opposed to the use of the CL package because of its
>> "stepping" all over the ELisp namespace. For years, this manifested
>> itself in the fact that use of CL within Emacs's own code was generally
>> shunned and tolerated only with (eval-when-compile (require 'cl)),
>> meaning that you could use CL only when it could be compiled away during
>> byte-compilation (by macro-expansion and/or inlining). So you could use
>> `ecase` but not `some`.
> How did you decide what should be renamed to cl-*?
Everything that was defined in the CL library.
> Why was IF not renamed to cl-if?
Because `if` was never defined in the CL library but in
`eval.c` (and the byte-compiler).
> Why do you think CASE is CL?
Because it's defined in `cl-macs.el`, i.e. in the CL library (tho this
file now belongs to the CL-Lib library).
The renaming was motivated by very practical constraints, so there was
very little opinion involved in which things were renamed and which weren't.
"Very little" is not the same as "no opinion", admittedly. For example,
I did refrain from renaming `setf` and instead re-implemented it outside
of CL-Lib, integrating it into "core ELisp".
Also, we later re-re-named things like `cl-caadr` to just `caadr`
(i.e. integrating it into "core Elisp").
> How do you feel about code like this?
>
> (defun tempo-is-user-element (element)
> "Try all the user-defined element handlers in `tempo-user-elements'."
> ;; Sigh... I need (some list)
> (catch 'found
> (mapc (lambda (handler)
> (let ((result (funcall handler element)))
> (if result (throw 'found result))))
> tempo-user-elements)
> (throw 'found nil)))
>
> Do you think duplicating SOME this way is better than embracing SOME?
Personally, I think it should (require 'cl-lib) and then use `cl-some`.
> In my code I just require cl-lib and add the cl- prefix where needed and
> live with that.
Same here.
Stefan
- Re: Advantage using mapc over dolist, (continued)
- Re: Advantage using mapc over dolist, Jean Louis, 2024/12/03
- Re: Advantage using mapc over dolist, Heime, 2024/12/03
- Re: Advantage using mapc over dolist, Jean Louis, 2024/12/03
- Re: Advantage using mapc over dolist, Stefan Monnier, 2024/12/03
- Re: Advantage using mapc over dolist, Heime, 2024/12/03
- Re: Advantage using mapc over dolist, Jean Louis, 2024/12/03
- Re: Advantage using mapc over dolist, Tomas Hlavaty, 2024/12/03
- Re: Advantage using mapc over dolist,
Stefan Monnier <=
- Re: Advantage using mapc over dolist, Heime, 2024/12/03
- Re: Advantage using mapc over dolist, Stefan Monnier, 2024/12/03
- Re: Advantage using mapc over dolist, Jean Louis, 2024/12/03
- Re: Advantage using mapc over dolist, Michael Heerdegen, 2024/12/03
Re: Advantage using mapc over dolist, Tassilo Horn, 2024/12/02