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: changing function signatures and no library version # => must use too-general test Date: Tue, 25 Apr 2006 14:57:23 -0400 Message-ID: References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1145991519 14262 80.91.229.2 (25 Apr 2006 18:58:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 25 Apr 2006 18:58:39 +0000 (UTC) Cc: Emacs-Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Apr 25 20:58:34 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FYSjx-0000Mo-Fp for ged-emacs-devel@m.gmane.org; Tue, 25 Apr 2006 20:58:25 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYSjx-0004Xf-2p for ged-emacs-devel@m.gmane.org; Tue, 25 Apr 2006 14:58:25 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FYSj6-000413-TS for emacs-devel@gnu.org; Tue, 25 Apr 2006 14:57:33 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1FYSj5-0003zI-5P for emacs-devel@gnu.org; Tue, 25 Apr 2006 14:57:31 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FYSj4-0003yy-TF for emacs-devel@gnu.org; Tue, 25 Apr 2006 14:57:30 -0400 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.52) id 1FYSla-0002ht-LH for emacs-devel@gnu.org; Tue, 25 Apr 2006 15:00:06 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id BAD4F2CF46F; Tue, 25 Apr 2006 14:57:29 -0400 (EDT) Original-Received: from asado.iro.umontreal.ca (asado.iro.umontreal.ca [132.204.24.84]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 97FFA445C; Tue, 25 Apr 2006 14:57:23 -0400 (EDT) Original-Received: by asado.iro.umontreal.ca (Postfix, from userid 20848) id 7B6DE71500; Tue, 25 Apr 2006 14:57:23 -0400 (EDT) Original-To: "Drew Adams" In-Reply-To: (Drew Adams's message of "Tue, 25 Apr 2006 10:30:30 -0700") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:53403 Archived-At: > There is no good way to test for the function with the right signature, > AFAIK. In Emacs 22 I could use `subr-arity' to test the number of args, > which would work in this case but not in cases where the number was the same > but the parameter types were different or their order changed - and, anyway, > that would require testing whether `subr-arity' is defined, and, if not, it > would require a different test (for Emacs other than 22). Testing with subr-arity won't work because it's not a subroutine, and even if it works it's difficult to use and inconvenient. A better check is: (condition-case nil (help-insert-xref-button arg1 arg2 arg3) (wrong-number-of-arguments (help-insert-xref-button arg6 arg7)) and interestingly, this approach can also be used when the number of args hasn't changed, as long as you can arrange for the first call to fail immediately (e.g. because you use some new type of argument that wasn't supported before). Of course, this is not 100% errorproof since the error you catch may actually come from some other piece of code within help-insert-xref-button. In many cases this is not a problem because you can be reasonably sure that having the same error signalled some other way is extremely unlikely (e.g. this is the case for wrong-number-of-arguments). Stefan