Re: Getting rid of the ugly call/kw
Lassi Kortela 03 May 2020 12:09 UTC
Thanks a lot for your persistence with the topic Marc! I greatly
appreciate your efforts to make sense of a very complex topic.
SRFI 177 is getting quite late and there is no obvious
compromise-free-solution in sight. Two fairly simple things could be done:
1) Leave lambda/kw out of 177 altogether. The SRFI would be left with
only define/kw and call/kw. We can always write an update SRFI to add
lambda/kw if it proves universally useful.
Even with no lambda/kw, users can still do things like this:
(define/kw (something x (kw1 kw2))
...)
(for-each (lambda (x) (call/kw something x))
some-list)
i.e. manually wrapping call/kw in a lambda where an ordinary lambda is
needed.
Though identifier syntax might be a good way to implement keyword
lambdas in general, it's not currently widely portable so it's not a
good fit for 177. A keyword procedure needs to be either an ordinary
lambda or an ordinary macro.
2) Make define/kw create macros instead of procedures so that call/kw is
not needed at the call site. I haven't thought about the implementation
at all, but might this work portably even with syntax-rules and
define-macro?
I'm not sure whether 1, or both 1 and 2, or neither would be the best
Opinions from everyone are very welcome.