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

Re: [Scheme-reports] Technical question



Ray Dillinger scripsit:

> But we haven't achieved symmetry yet.  Functions can report an arity
> error when called with the wrong number of arguments.  According to
> the formal semantics they have to wait until the arguments have been
> evaluated before doing so, but one of the first things that the code
> for a two-argument function does is to check and make sure that it has
> two arguments.

They MAY do so, but it's not a requirement.  Procedures may ignore
unwanted arguments or supply default values for missing arguments,
if the implementer thinks that serves the goals of the users better.
Exactly the same choice is provided for continuations: report an error,
ignore extras, or do something else.

> Under my language-design hat, I think that we should consider ways   
> to create continuations with a definite (maximum) number of required 
> arguments and enable too-many-returns arity errors, fleshing out the 
> parallelism with function calls.  Under my language-standardization  
> hat, I note that no such work is now tested or implemented, and that 
> therefore standardization of such a thing would be premature.        

I once proposed that Chicken support the syntax (lambda n (args) .
body), where n is a compile-time exact integer, to declare that this
procedure returns exactly n values.  Felix shot it down as too ugly,
so currently even in Chicken, where procedure/continuation duality is
actual identity due to the CPS conversion, there is still redundant
checking of argument counts.

-- 
But that, he realized, was a foolish            John Cowan
thought; as no one knew better than he          cowan@x
that the Wall had no other side.                http://www.ccil.org/~cowan
        --Arthur C. Clarke, "The Wall of Darkness"

_______________________________________________
Scheme-reports mailing list
Scheme-reports@x
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports