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

arity failures

This page is part of the web mail archives of SRFI 102 from before July 7th, 2015. The new archives for SRFI 102 contain all messages, not just those from before July 7th, 2015.



So "passing" an arity check doesn't mean that the number of arguments
you pass is correct, as Dybvig's already noted.

Also, "failing" an arity check doesn't mean that you will get any kind
of error or exception as a result.

For example, in response to the question, "what is the arity of read", I
said that under my proposal,
  (procedure-arity read) => 0, #t
and then I gave code which throws an error if more than one argument is
passed.  But no error is required by Scheme, both because an
implementation is free to assign a meaning to (read a b c), and further,
because an implementation is free to assign a meaning in general to
"extra arguments" passed to procedures.

I can understand then "arity" to mean something which matches the syntax
specification for lambda formals lists, in which there is a minimum and
permission for more arguments.

People seem to want some *other* meaning than that.  Something like "the
number of arguments that can be passed without signaling an error",
though that's not a very clear concept without specifying which errors
are involved.  Moreover, for the reasons Dybvig has indicated
previously, this is not something most systems could successfully
implement, what with passing argument lists around via apply and such.

So, to recap:

Being told that a procedure takes, say, exactly three arguments, does
not mean that
  1) You won't get an error for passing three arguments;
  2) You will get an error for passing other than three arguments.

However, I believe it could mean that:
  * The procedure was created with a proper lambda formals list
containing exactly three identifiers.

Thomas