chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Chicken-users] Limitation of Chicken's keyword arguments


From: Luke McCarthy
Subject: [Chicken-users] Limitation of Chicken's keyword arguments
Date: Tue, 1 Apr 2008 23:01:37 +0100
User-agent: KMail/1.9.9

Keyword arguments in Chicken don't work where the keywords precede the rest 
list, e.g. (a href: "url" "text").

(define (a #!rest args #!key href) ...)

In the call (a href: "foo" "bar") href is bound to "foo" as expected but args 
is bound to (href: "foo" "bar") not ("bar").

The behaviour makes sense from the point of view of the implementation. It 
would be less efficient to support the idiom since the rest list would have 
to be post-processed to remove keyword arguments.

It might be worth noting that Python's keyword arguments are limited in the 
same way (but throw exceptions instead).

I suppose it would not be much trouble to write a macro (like let-optionals) 
to get the behaviour you wanted. I just thought it might be worth metioning 
or discussing.

Luke




reply via email to

[Prev in Thread] Current Thread [Next in Thread]