emacs-devel
[Top][All Lists]
Advanced

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

Re: check argument count in defcustom :safe?


From: Stefan Monnier
Subject: Re: check argument count in defcustom :safe?
Date: Sat, 11 Apr 2015 23:48:13 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux)

>   :safe  'functionp)

FWIW, I think it makes absolutely no sense for :safe to be `functionp'.
This is just a gaping security hole.  And checking the number of
arguments would make no difference in this respect.

> but I don't see any way to access the argument count from lisp.  Am I
> missing something?

The number of arguments passed to a function is something that can be
easily checked by the function, but checking the number of arguments
accepted by a function is generally impossible (think of a function like

   (lambda (&rest args)
     (if (> (length args) (if (halting-p (car args)) 2 3))
         (signal 'wrong-number-of-arguments 'foo (length args)))
     ...)


-- Stefan



reply via email to

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