[bitc-dev] currying for zero arguments

Sam Mason sam at samason.me.uk
Fri Mar 13 12:16:57 EDT 2009

On Thu, Mar 12, 2009 at 12:06:44PM -0500, Jonathan S. Shapiro wrote:
> On Thu, Mar 12, 2009 at 11:03 AM, Geoffrey Irving <irving at naml.us> wrote:
> > In ocaml/haskell/etc., all functions take at least one argument, and
> > parentheses only need to occur in one of the arguments is a unit.
> Notso.
> In ocaml/haskell/etc, all functions take *exactly* one argument, and
> pairs must be introduced in ordertopass multiple arguments in a single
> application.
> As we discussed in another thread, the optimization that lifts curried
> procedures into conventionally multiargument procedures is not
> transparent w.r.t. allocation effects. So far as I can tell, this
> forces us into n-ary functions.

One option could be at parse time to effectively treat things in
the conventional functional style (i.e. functions always accept and
return one value and to do anything else you have to curry) and put
a restriction in after parsing to check that you're always reducing
down to a conventional multi-parameter procedure call.  This obviously
can't be a type level check, as a procedure can return a reference to a
function.  It seems probable that this restriction could be eased with
more analysis in some circumstances.

Not sure if that helps things at all!

  Sam  http://samason.me.uk/

More information about the bitc-dev mailing list