GNU bug report logs -
#40968
28.0.50; (apply nil)
Previous Next
Reported by: Pip Cet <pipcet <at> gmail.com>
Date: Wed, 29 Apr 2020 18:27:02 UTC
Severity: normal
Tags: fixed
Found in version 28.0.50
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
> > > Is the function signature relevant for anything but eldoc?
It should be relevant in terms of raising an error
if the signature is not respected.
> > Besides the docstring, the manual documents it. The suggested form
> > is unusual and makes it harder to understand, IMHO.
>
> I think it's hard to understand Elisp apply from a standard signature,
> because it's really
>
> (apply FUNCTION &rest INDIVIDUAL-ARGUMENTS ARGUMENT-LIST)
> or
> (apply FUNCTION-AND-ARGUMENT-LIST)
>
> The latter (which takes a single argument) is not a special case of
> the former (which takes 2,3,4,... arguments).
(apply FUNCTION) and (apply) should raise an
error, IMO (as in Common Lisp).
Is there a good use case for either?
> > If I understand correctly, you propose a three argument form:
> > (apply FUNCTION ARGUMENT &rest ARGUMENTS)
>
> That's a 2,3,4...-argument form.
It's what Common Lisp prescribes.
> > This is what I find unusual. It should really be either
> > (apply FUNCTION &rest ARGUMENTS)
> > or (apply FUNCTION ARGUMENTS)
>
> That's a 2-argument form.
That second form is the same as (apply FUNCTION ARGUMENT).
And in that second form it's fine for ARGUMENT to be nil.
The first form should raise an error if ARGUMENTS is nil.
> > Maybe there's a case to be made for a syntactic alternative to
> > "&rest" which disallows nil, which I guess is the issue here?
An &rest which must not be nil is written as:
ARGUMENT &rest MORE-ARGS
&rest is just a list. It can always be nil.
> > My point is mainly that it has two arguments: f and args.
>
> I think we're all in agreement about 2-argument apply.
> 3,4,...-argument apply is an unfortunate legacy but one we're stuck
> with now. 1-argument apply is the issue here.
I'm not in agreement, FWIW. The behavior and its
description should be as for Common Lisp: require
at least 2 args: FUNCTION and its first ARGUMENT.
Is there some use case for (apply f) and (apply)?
This bug report was last modified 4 years and 238 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.