On Tue, Nov 13, 2012 at 3:03 PM, Mark Tarver <
dr.mt...@gmail.com> wrote:
> Named parameters really came into play in Common Lisp because of the
> multiplicity of functions with optional parameters. Sometimes these
> had n optional parameters for n = 2, 3 or even more. Without some
> sort of naming, using the correct ordering out of n! choices would be
> the only way forward. Since the latter was not really acceptable,
> naming was used to allow programmers to enter options in an order-free
> manner.
>
> Type theoretically this is a PITA, so I avoided it.
I don't think it needs to be. The way I see it, the underlying
function is always type specific. The named, optional, etc. are all
just syntax sugar. Maybe could be done with macros? At the very least,
I'm sure klambda would not be affected.
So at "preprocessing" time, this:
(write to:A value:B with:C)
is converted to:
(write A C B) (if we messed with the order)
"optional" parameters would only be optional if they were provided
default values, so as far as the implementation of the function goes,
it would never have any missing params.
(write to:A value:B) would be (write A default-value C)