unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: Stephen Leake <stephen_leake@stephe-leake.org>
Cc: emacs-devel@gnu.org
Subject: Re: check argument count in defcustom :safe?
Date: Sat, 11 Apr 2015 23:48:13 -0400	[thread overview]
Message-ID: <jwv8udyj9sf.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <85a8yehdsn.fsf@stephe-leake.org> (Stephen Leake's message of "Sat, 11 Apr 2015 10:42:32 -0500")

>   :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	other threads:[~2015-04-12  3:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-11 15:42 check argument count in defcustom :safe? Stephen Leake
2015-04-12  3:48 ` Stefan Monnier [this message]
2015-04-12  6:45   ` Philipp Stephani
2015-04-12 10:00     ` Artur Malabarba
2015-04-12 11:59     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwv8udyj9sf.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=stephen_leake@stephe-leake.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).