[bitc-dev] Re-thinking currying
David-Sarah Hopwood
david.hopwood at industrial-designers.co.uk
Tue Jan 20 22:53:37 CST 2009
Jonathan S. Shapiro wrote:
> Specifically, I am considering a change to the apply rule where, given:
>
> (f a b c)
> f: (fn 'a 'b -> (fn 'c -> 'd))
>
> we would canonicalize this apply based on the function type of f into:
>
> (apply (apply f a b) c)
>
> This is "curry like"; the main difference being that it supports N-ary
> functions.
Does this mean that the dynamic semantics depends on types, i.e. a BitC
program cannot be executed by erasing all types, and then running the
resulting program in a corresponding untyped language?
That seems like a property that should not be sacrificed without
some thought. (I don't know whether there are any other reasons why
it already doesn't apply to BitC.)
> The main use case for this, by the way, is variadic functions that
> accept an argument of type DYNAMIC. Namely: printf-like functions.
When calling a printf-like function, you know at the call site which
arguments are variadic. As long as the syntax is still fairly concise,
I don't think it would matter if calling such a function required a
slightly different syntax than calling a non-variadic function with
the same total number of arguments.
--
David-Sarah Hopwood ⚥
More information about the bitc-dev
mailing list