[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: changing function signatures and no library version # => must use to
From: |
Stefan Monnier |
Subject: |
Re: changing function signatures and no library version # => must use too-general test |
Date: |
Tue, 25 Apr 2006 14:57:23 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> 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
- changing function signatures and no library version # => must use too-general test, Drew Adams, 2006/04/25
- Re: changing function signatures and no library version # => must use too-general test,
Stefan Monnier <=
- RE: changing function signatures and no library version # => must use too-general test, Drew Adams, 2006/04/25
- Re: changing function signatures and no library version # => must use too-general test, Stefan Monnier, 2006/04/25
- RE: changing function signatures and no library version # => must use too-general test, Drew Adams, 2006/04/25
- Re: changing function signatures and no library version # => must use too-general test, Miles Bader, 2006/04/25
- Re: changing function signatures and no library version # => must use too-general test, Stefan Monnier, 2006/04/26
- RE: changing function signatures and no library version # => must use too-general test, Drew Adams, 2006/04/26