* alendvai [2007-01-06 13:59+0100] writes:
Modified Files: slime.el Log Message: Added set-keymap-parents when not available (GNU Emacs). Result: slime bindings while reading expressions from the minibuffer.
I'm I the only who is annoyed by the introduction of Xemacsisms and more generally the use of defun* in Emacs Lisp code?
I'm I the only who is annoyed by the introduction of Xemacsisms and
i would put it different: there are some quite useful functions (like set-keymap-parents) that happen to be available in xemacs but not in gnu emacs. therefore they are optionally defined to avoid redefining them when running under xemacs.
i could have added it as slime-set-keymap-parents which would have been even worse, imho.
as of defun*: i think that keyword args make the code much more readable than using optional parameters, especially when there are several optional args.
I will only comment on the technical questions.
"Attila Lendvai" attila.lendvai@gmail.com writes:
[Helmut wrote:]
I'm I the only who is annoyed by the introduction of Xemacsisms and
i would put it different: there are some quite useful functions (like set-keymap-parents) that happen to be available in xemacs but not in gnu emacs. therefore they are optionally defined to avoid redefining them when running under xemacs.
i could have added it as slime-set-keymap-parents which would have been even worse, imho.
In my opinion, this solution would be preferable.
as of defun*: i think that keyword args make the code much more readable than using optional parameters, especially when there are several optional args.
I have been using defun* myself in SLIME code. The Emacs Lisp code of SLIME contains many CL-isms; could people (Helmut, Edi) please comment what is the specific problem with defun*?
Cheers,
* Matthias Koeppe [2007-01-07 13:55+0100] writes:
I have been using defun* myself in SLIME code. The Emacs Lisp code of SLIME contains many CL-isms; could people (Helmut, Edi) please comment what is the specific problem with defun*?
Emacs Lisp code should look like idiomatic Emacs Lisp not like CL. Mindlessly applied CL-isms should be removed.
Keyword args are a win if the function has lots of arguments (> 5). For some functions it's reasonable to have lots of parameters, e.g. stuff that is called from a config file or things that implement Little Languages like format or loop. (Or functions which need to be backward compatible, though that's a non-issue for Slime.)
But almost any other function should have few arguments, because more arguments almost always lead more complicated code. It's IMO better to have lots of short functions with few args, than a few functions with lots of arguments. defun* encourages lots of args and complicated code.
Emacs Lisp puts a nice limit on the number of arguments: as soon as you want to add keyword args, you know that you have already to many arguments.
Despite that, backtraces and docstrings for defun* are notoriously unhelpful.
Helmut.
On Sat, 06 Jan 2007 15:14:46 +0100, Helmut Eller heller@common-lisp.net wrote:
I'm I the only who is annoyed by the introduction of Xemacsisms and more generally the use of defun* in Emacs Lisp code?
No, you're not alone. I was going to say the same thing.