emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [External] : optional argument defaults in `cl-defun' vs old way - w


From: Emanuel Berg
Subject: Re: [External] : optional argument defaults in `cl-defun' vs old way - warning, discrepancy!
Date: Sat, 07 Oct 2023 15:12:22 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Drew Adams wrote:

> I think what you really mean to say is that `&optional foo'
> can convey something a bit different to human readers, in
> terms of intent than does `&optional (foo nil)`.
>
> That's true.
>
> But I wouldn't call the latter "the CL way" and the former
> "the Elisp way". The real CL way is to let you use
> either/both.

Call it the `defun' way vs the `cl-defun' way then.

I used to perceive the situation like this:

- with defun you have to always check the optional args for
  nil and, if so, set them to a default value

- with cl-defun, you don't have to do that because you can
  use the syntax to do that

However now it turns out that syntax isn't equivalent to the
defun way, so sometimes you have to check for SVAR.

So the advantages with cl-defun in this case - i.e.
optional args - which was a more compact syntax - is dubious
since it is not exhaustive, and sometimes (when?) you have to
check for SVAR. So defun is more clear (nil always means use
the default) and you also always have to check and set this,
compared to cl-defun when you sometimes has to do something
and you have to actively figure out when.

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

[Prev in Thread] Current Thread [Next in Thread]