Re: [Scheme-reports] Technical question Aaron W. Hsu (26 May 2011 22:01 UTC)
Re: [Scheme-reports] Technical question Alex Shinn (26 May 2011 22:25 UTC)
Re: [Scheme-reports] Technical question Eli Barzilay (29 May 2011 08:50 UTC)
Re: [Scheme-reports] Technical question Jay Reynolds Freeman (26 May 2011 23:07 UTC)
Re: [Scheme-reports] Technical question Anton van Straaten (27 May 2011 03:04 UTC)
Re: [Scheme-reports] Technical question Jay Reynolds Freeman (27 May 2011 04:36 UTC)
Re: [Scheme-reports] Technical question Anton van Straaten (27 May 2011 08:43 UTC)
Re: [Scheme-reports] Technical question Ray Dillinger (27 May 2011 16:35 UTC)
Re: [Scheme-reports] Technical question John Cowan (27 May 2011 18:02 UTC)
Re: [Scheme-reports] Technical question Andy Wingo (27 May 2011 06:58 UTC)

Re: [Scheme-reports] Technical question John Cowan 27 May 2011 18:00 UTC

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@ccil.org
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@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports