procedure-arity-mask and keywords Per Bothner (15 Apr 2020 00:28 UTC)
Re: procedure-arity-mask and keywords Lassi Kortela (15 Apr 2020 07:41 UTC)
Re: procedure-arity-mask and keywords Marc Nieper-Wißkirchen (15 Apr 2020 08:46 UTC)
Re: procedure-arity-mask and keywords Lassi Kortela (15 Apr 2020 09:28 UTC)
Re: procedure-arity-mask and keywords Lassi Kortela (15 Apr 2020 09:32 UTC)
Re: procedure-arity-mask and keywords Marc Nieper-Wißkirchen (15 Apr 2020 09:47 UTC)
Re: procedure-arity-mask and keywords Lassi Kortela (15 Apr 2020 09:58 UTC)

Re: procedure-arity-mask and keywords Lassi Kortela 15 Apr 2020 07:41 UTC

> It would be helpful if the specification offered some guidance on what
> procedure-arity-mask should return for a procedure that takes keyword
> arguments.

Agreed.

> One possibility is to just return -1.

While valid, this makes it impossible to tell anything about the
positional arguments to that procedure. As soon as you add a keyword
argument to a non-keyword procedure, the arity information about that
procedure that was formerly available is lost.

> Another that it returns a value corresponding to how many non-keyword
> arguments are allowed (assuming no keywords arguments are required).

This sounds like the right thing.

More generally, the concept of arity should probably apply to positional
arguments only. It doesn't really make sense for kw args. You can count
the number of keywords in the procedure definition but it's not that
useful since they can usually be given in any combination.

For kw args, it would be more useful to return a list of all the
accepted keywords (and maybe a boolean to indicate allow-other-keys).