|
From: | Adam Porter |
Subject: | Re: What's missing in ELisp that makes people want to use cl-lib? |
Date: | Mon, 30 Oct 2023 21:31:41 -0500 |
User-agent: | Mozilla Thunderbird |
Do people really want `cl-pushnew', with its keyword arguments? Or would a simple `pushnew' be even more pleasing?
It might be more aesthetically or ideologically pleasing, but it would be much less useful. :test is often necessary for using EQUAL (as EQ is often the wrong function to use); without it, a hypothetical non-CL PUSHNEW function would often be unusable. And :key makes it easy to use with, e.g. structs' accessor functions (which are very helpful for developers as they allow compile-time checking, completion, etc).
When CL-PUSHNEW is called without keyword arguments, it's as simple as a hypothetical non-CL PUSHNEW that offered no keyword arguments. The keyword arguments provide optional flexibility; without them, one would have to write a much larger, more complex form to do the same things.
Finally, if there were an additional, non-CL PUSHNEW function added, I would think that would be much more confusing to users, especially new ones, for there to be a difference in behavior between PUSHNEW and CL-PUSHNEW.
So I would ask that CL-PUSHNEW become PUSHNEW as-is.
To define `pushnew' in Emacs Lisp, and document it in the Emacs Lisp Reference Manual, would be much cleaner than spreading the use of cl-lib to more files.
I would be happy to see more cl-lib functions "moved" back into "core" Elisp. Using Elisp without cl-lib feels restrictive to me.
By the way, with regard to CL-PUSHNEW, it seems surprising that no one's mentioned the existing counterpart in "core" Elisp, ADD-TO-LIST. Notably, its docstring says:
This is handy to add some elements to configuration variables, but please do not abuse it in Elisp code, where you are usually better off using ‘push’ or ‘cl-pushnew’.So even "core", non-cl-lib Elisp recommends the use of some cl-lib functions, i.e. CL-PUSHNEW. That certainly suggests a "gap" in core Elisp functionality.
--Adam
[Prev in Thread] | Current Thread | [Next in Thread] |