Example? Alexey Radul (22 Sep 2009 12:43 UTC)
Re: Example? David Van Horn (22 Sep 2009 20:49 UTC)

Re: Example? David Van Horn 22 Sep 2009 20:49 UTC

Alexey Radul wrote:
> I wonder about the utility of a facility like this when it has such
> weak guarantees.  Can you give an example of a situation when this
> would be useful without having confidence that the arity information
> is accurate at least for "most" procedures?

I believe it is useful for reporting diagnostic information such as
generating good error messages.  Aubrey Jaffer wrote of the Clinger
proposal in 1996 that it "offers a solution to the problem of generating
useful, uniform error messages for the dozen implementations supporting
SLIB -- something currently lacking."  The Clinger proposal makes no
stronger guarantees than this proposal.

> It also seems that including a means by which the programmer can
> declare arity information for procedures (perhaps including system
> procedures) could significantly improve the accuracy (and therefore
> usefulness) of arity information, in particular about the arities of
> procedures produced by procedure combinators.  In the presence of
> mutation and procedures being comparable by eq?, such a mechanism
> could be implemented with a (weak) eq? hash table on procedures.
> (For what it's worth, declaring arity information for procedures is
> semantically different from restricting the arities of procedures,
> and may therefore enjoy broader use).

First of all, let me point out that procedures are not comparable by `eq?'.

I agree this would be useful.  I am reluctant to expand the scope of
this SRFI, however.  Is this issue important to others, and is there a
an interface for doing this that is supported by multiple Scheme
systems?  (I am trying to introduce no novel designs in this SRFI).

It would seem that if there is not a strong precedent for such
facilities, it is best put off for another SRFI to take up, which of
course can be designed to work with this one.

David