Email list hosting service & mailing list manager

Efficient compilation of functions with keyword arguments Lassi Kortela (22 Jul 2019 15:08 UTC)
Re: Efficient compilation of functions with keyword arguments Per Bothner (23 Jul 2019 00:31 UTC)

Re: Efficient compilation of functions with keyword arguments Per Bothner 23 Jul 2019 00:30 UTC

On 7/22/19 8:08 AM, Lassi Kortela wrote:
> Robert Strandh, author of the Common Lisp implementation SICL, graciously replied to my inquiry and took the time to explain keyword arguments to us in detail.

> (defun foo (arg &rest more-args &key &allow-other-keys)
>    (apply #'bar arg :new-key val more-args))

In Kawa:

(define (foo arg val @:more-args)
   (bar arg new-key: val @:more-args))

This assumes new-key does not duplicate any keywords in more-args.
If you want to *override* a keyword value, it's more complicated.
Kawa's philosophy (unlike Common Lisp) is that a duplicate keyword indicates an error.
However, it is missing a convenient way to explicitly override/replace a keyword.
This should be part of the ArgListBuilder interface.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/