Email list hosting service & mailing list manager

Procedures with keyword arguments should be macros not procedures Marc Nieper-Wi├čkirchen (17 Oct 2019 09:17 UTC)
Re: Procedures with keyword arguments should be macros not procedures Marc Nieper-Wi├čkirchen (17 Oct 2019 10:48 UTC)
Re: Procedures with keyword arguments should be macros not procedures Per Bothner (17 Oct 2019 20:44 UTC)
Intricate lambda list syntax Lassi Kortela (18 Oct 2019 08:26 UTC)
Re: Intricate lambda list syntax Shiro Kawai (18 Oct 2019 09:18 UTC)
Re: Intricate lambda list syntax Lassi Kortela (18 Oct 2019 14:29 UTC)
Re: Intricate lambda list syntax Shiro Kawai (18 Oct 2019 17:32 UTC)

Re: Procedures with keyword arguments should be macros not procedures Per Bothner 17 Oct 2019 20:44 UTC

On 10/17/19 1:33 PM, Lassi Kortela wrote:
>> Apart from efficiency concers, classic Common Lisp-style keyword args
>>> are also hard to type-check statically.
>>
>> Actually they aren't, as long as the keywords are apparent at the point of
>> call.
>
> That seems true, but there has to be a reason why Kawa and Racket both have keywords as syntax markers instead of actual keyword objects. The reason was discussed in that big keywords thread in July but escapes me.

Consider:
     (f x y z)
Obvious a call to f with 3 positional (non-keyword) arguments, right?

But what about:
     (define y k1:)
     (f x y z)

Ooops. Turns out if was 1 positional and 1 keyword argument.
But only if f allows keyword arguments.

Unless you have some kind of type-checking/data-flow you can't guard
against this.  Even with that type of analysis you can't always *prove*
whether y is a keyword or not, so you have to compile conservative code
and check at run-time.
--
	--Per Bothner
xxxxxx@bothner.com   http://per.bothner.com/