From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: check argument count in defcustom :safe? Date: Sat, 11 Apr 2015 23:48:13 -0400 Message-ID: References: <85a8yehdsn.fsf@stephe-leake.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1428810523 14104 80.91.229.3 (12 Apr 2015 03:48:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 12 Apr 2015 03:48:43 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stephen Leake Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 12 05:48:35 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Yh8sr-00060T-ET for ged-emacs-devel@m.gmane.org; Sun, 12 Apr 2015 05:48:33 +0200 Original-Received: from localhost ([::1]:44352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yh8sq-0001Jm-R3 for ged-emacs-devel@m.gmane.org; Sat, 11 Apr 2015 23:48:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60827) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yh8se-0001Jh-Vg for emacs-devel@gnu.org; Sat, 11 Apr 2015 23:48:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yh8sZ-0000fZ-UL for emacs-devel@gnu.org; Sat, 11 Apr 2015 23:48:20 -0400 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:36235) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yh8sZ-0000fV-PJ for emacs-devel@gnu.org; Sat, 11 Apr 2015 23:48:15 -0400 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t3C3mDj7007261; Sat, 11 Apr 2015 23:48:14 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id B0AE4AE11C; Sat, 11 Apr 2015 23:48:13 -0400 (EDT) In-Reply-To: <85a8yehdsn.fsf@stephe-leake.org> (Stephen Leake's message of "Sat, 11 Apr 2015 10:42:32 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5273=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5273> : inlines <2686> : streams <1421020> : uri <1904640> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.22 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:185316 Archived-At: > :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