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: Arbitrary function: find the number(s) of expected arguments Date: Sat, 26 Mar 2016 13:20:27 -0400 Message-ID: References: <56E8906C.5050405@lanl.gov> <83egb68vfy.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1459012860 26045 80.91.229.3 (26 Mar 2016 17:21:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 26 Mar 2016 17:21:00 +0000 (UTC) Cc: emacs-devel To: Elias =?windows-1252?Q?M=E5rtenson?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 26 18:20:52 2016 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 1ajrtL-0000Kq-IR for ged-emacs-devel@m.gmane.org; Sat, 26 Mar 2016 18:20:51 +0100 Original-Received: from localhost ([::1]:32827 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ajrtK-00016W-DT for ged-emacs-devel@m.gmane.org; Sat, 26 Mar 2016 13:20:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ajrt2-00015z-M7 for emacs-devel@gnu.org; Sat, 26 Mar 2016 13:20:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ajrsz-00089o-GO for emacs-devel@gnu.org; Sat, 26 Mar 2016 13:20:32 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:25023) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ajrsz-00089d-Bh for emacs-devel@gnu.org; Sat, 26 Mar 2016 13:20:29 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0A+FgA731xV/5a2xEVcgxCEAoVVwwsEAgKBPD0QAQEBAQEBAYEKQQWDXQEBAwFWIxALNBIUGA0kiDcIzyMBAQEHAgEfizqFBQeELQEEsz+BRSOBZoIuIoJ4AQEB X-IPAS-Result: A0A+FgA731xV/5a2xEVcgxCEAoVVwwsEAgKBPD0QAQEBAQEBAYEKQQWDXQEBAwFWIxALNBIUGA0kiDcIzyMBAQEHAgEfizqFBQeELQEEsz+BRSOBZoIuIoJ4AQEB X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="199590965" Original-Received: from 69-196-182-150.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([69.196.182.150]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 26 Mar 2016 13:20:28 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 33277AE071; Sat, 26 Mar 2016 13:20:27 -0400 (EDT) In-Reply-To: ("Elias =?windows-1252?Q?M=E5rtenson=22's?= message of "Sat, 26 Mar 2016 23:55:03 +0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:202259 Archived-At: >> As mentioned to my reply in the corresponding thread, you're better off >> just making the call and catching the potential >> `wrong-number-of-arguments' signal. > Isn't that really dangerous? You're going to catch that error from any > function call, not just the top one that you are interested in. Sounds like > something that would be he'll to debug if it hit you. That error should normally never be signaled, so the likelihood of there being a problem is extremely small. I've never had trouble with it, including when debugging things. Even when debugging wrong-number-of-arguments errors, this error has always been re-signaled in the "alternative calling case", so it never ended up hiding a real problem (and even less so causing such a problem). Of course, in theory it can. But then, in theory testing the function's arity can also fail in all kinds of ways. Stefan