[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Arbitrary function: find the number(s) of expected arguments

From: Drew Adams
Subject: RE: Arbitrary function: find the number(s) of expected arguments
Date: Fri, 25 Mar 2016 11:19:04 -0700 (PDT)

(Please use plain-text for this mailing list from now on. I won't bother trying to convert the formatting this time.)


> IIUC, you _cannot_ use `func-arity' to test whether something

> is a subr.

Yes, but you can and should use `subrp' for that.

Of course you can. But that's irrelevant here. This is about what `subr-arity' does. Its behavior is not the same as `func-arity' for a non-subr. If we are not deprecating `subr-arity' then it is not enough to send users to the doc for `func-arity'.

> IOW, I am repeating the same argument I made before, when

> I said that `subr-arity' should not be deprecated and

> simply replaced by `func-arity'.

I understood it as argument against aliasing `subr-arity' to

the new function: this can break _existing_ code if it relies

on the fact that `subr-arity' signals an error when called with

anything, but builtin.

Yes. And?

The same argument applies to just having its doc string tell users to use `func-arity'. That might not break existing code, but it breaks the doc string. It no longer says what function `subr-arity' does. And it gives the false impression that `func-arity' does the same thing. In fact, `func-arity' does something different if the arg is not a subr.

> This is a step backward.  Unless we are really deprecating

> and replacing it, we should document `subr-arity' properly,

> as before, with the addition of cross-ref to see `func-arity',

> stating that it handles any type of function.

I personally don't see why we need two functions for this.

So, I would deprecate `subr-arity', but keep it around for

backward compatibility.

I personally feel the opposite - see my argument about not breaking existing code. But if that will be the decision then that's different. So far, there has been no decision to deprecate `subr-arity', AFAIK.

On the other hand, I don't really care. All I want is that there

is `func-arity' that works for _any_ function. I'm not attached

to anything in the patch and as long as `func-arity' works,

`func-arity' works for any function. So your want is satisfied.

However, obtaining your want at the expense of also breaking a doc string is not right.

feel free to change anything.

I'm not going to change the broken doc string. But I certainly hope that someone will.

When code is improved, if that change entails needing to change the doc, then the doc should be updated appropriately.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]