Re: Default value of keyword arguments Lassi Kortela 04 Mar 2020 17:33 UTC

> - an implicit closure is created and the expressions generating default
> argument values are evaluated in that closure, remembering the old
> values (as in Python above).

Sorry, the Python example evaluates the default value expression once
only. It's also possible to evaluate the expression afresh every time a
default value is needed, but if it refers to variables inside some
closure, the semantics are confusing.

(defun proc1 (&key (foo foo)) ...)  <-- what happens?

(defun proc2 (&key (foo 1) (bar (+ foo 1))) ...)  <-- what happens?

These questions have answers in CL, but those answers are not obvious.