Email list hosting service & mailing list manager

Rest arguments Marc Nieper-Wißkirchen (03 Mar 2020 08:12 UTC)
Re: Rest arguments Lassi Kortela (03 Mar 2020 12:52 UTC)
Re: Rest arguments John Cowan (03 Mar 2020 14:17 UTC)
Re: Rest arguments Marc Nieper-Wißkirchen (03 Mar 2020 14:38 UTC)
Re: Rest arguments Lassi Kortela (03 Mar 2020 15:52 UTC)
Re: Rest arguments Marc Nieper-Wißkirchen (03 Mar 2020 15:58 UTC)
Re: Rest arguments Lassi Kortela (03 Mar 2020 16:20 UTC)

Re: Rest arguments Lassi Kortela 03 Mar 2020 15:52 UTC

> As far as I have understood SRFI 177, we have positional arguments
> and keyword arguments and both are disjoint.  There is nothing like
> superfluous keyword arguments.  So superfluous position arguments can
> get into a rest list argument and this is completely orthogonal to
> keyword arguments.

That's correct in principle. However, the situation is complicated by
the fact that 177 has to run on lots of Schemes that don't have native
keyword arguments. In that case we use the rest argument as a plist of
the keyword arguments. This is done so that ordinary `apply` and
procedure call syntax can be used to portably call a keyword lambda in
the case where no keyword arguments are passed to it, only positional args.

Your idea of a `parameterize`-based implementation would allow the rest
argument to be used for positional arguments even in these Schemes.
However, in my experience these fancy lambda-list features mainly lead
to confusing code, so I'd like to keep 177 simple and not have it
dictate anything about rest arguments. In practice, call/kw from 177 can
be used to call procedures that take both keyword args and a positional
rest arg, in Scheme implementations that make the distinction and parse
keywords specially. lambda/kw doesn't let you define such procedures,
but other, compatible systems may.