chicken-users
[Top][All Lists]
Advanced

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

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


From: Kon Lovett
Subject: Re: [Chicken-users] Limitation of Chicken's keyword arguments
Date: Wed, 2 Apr 2008 16:10:41 -0700


On Apr 1, 2008, at 3:01 PM, Luke McCarthy wrote:
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").

It works as documented, just not as desired.


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.

See "misc-extn-dsssl" for some support procedures.


Luke


_______________________________________________
Chicken-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/chicken-users

Best Wishes,
Kon






reply via email to

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