emacs-devel
[Top][All Lists]
Advanced

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

Problem in the Elisp manual concerning arguments?


From: David Kastrup
Subject: Problem in the Elisp manual concerning arguments?
Date: Tue, 08 Jul 2008 16:23:30 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Hi, I just read in

File: elisp,  Node: Argument List,  Next: Function Documentation,  Prev: Simple 
Lambda,  Up: Lambda Expressions

    12.2.3 Other Features of Argument Lists
    ---------------------------------------

[...]

       To specify optional arguments that may be omitted when a function is
    called, simply include the keyword `&optional' before the optional
    arguments.  To specify a list of zero or more extra arguments, include
    the keyword `&rest' before one final argument.

       Thus, the complete syntax for an argument list is as follows:

         (REQUIRED-VARS...
          [&optional OPTIONAL-VARS...]
          [&rest REST-VAR])

[...]

       A call to the function requires one actual argument for each of the
    REQUIRED-VARS.  There may be actual arguments for zero or more of the
    OPTIONAL-VARS, and there cannot be any actual arguments beyond that
    unless the lambda list uses `&rest'.  In that case, there may be any
    number of extra actual arguments.

       If actual arguments for the optional and rest variables are omitted,
    then they always default to `nil'.

Now that is pretty much wrong where it concerns the "rest" variable: if
actual arguments are omitted, _REST-VAR_ is set to nil, but that does
not make anything the arguments "default to nil".  And even if "they"
does not mean the arguments, but the variables, "nil" is not really a
default for the rest variable, but a fully specified value (indicating
an empty list rather than an absence of a list).

    There is no way for the function to distinguish between an explicit
    argument of `nil' and an omitted argument.

Again, for &rest this is wrong, since we get (nil) in one case, and nil
in the other, and both are perfectly distinguishable.

-- 
David Kastrup




reply via email to

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