Re: Procedures with keyword arguments should be macros not procedures Lassi Kortela 17 Oct 2019 11:30 UTC
> I think losing first-class-ness is too much cost to pay. Gauche heavily > uses keyword arguments > for implementation-specific extensions to ordinary procedures, and that's > the merit of keyword > arguments---you can add extra feature to existing procedures; if you need > to define macros, > you can define another procedure just as well. Thanks for chiming in. This is a very useful perspective since you have a lot of real-world experience working with them. > Srfi-177 doesn't say > keyword arguments > should always be processed as if passed as rest arg, so an implementation is > free to optimize > when the caller provides keyword argument via keyword-call (as opposed to > apply). Indeed, for the implementations that have native keyword args, the macro expansions are like this: (lambda (:key a b c) ...) ; keyword-lambda (foo :a 1 :b 2: c 3) ; keyword-call So they are exactly equal in efficiency to implementation-native ones. It's up to the implementation's static analyzer to find out whether it can optimize the calls to use a fast-path that skips the generic keyword parsing.