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: John Cowan
Subject: Re: [Chicken-users] Limitation of Chicken's keyword arguments
Date: Tue, 1 Apr 2008 23:52:13 -0400
User-agent: Mutt/1.5.13 (2006-08-11)

Luke McCarthy scripsit:

> 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.

Remember that keywords are evaluated like any other arguments: it just
so happens that keywords evaluate to themselves.  Common Lisp in this
case processes the keyword arguments *and* leaves them in the rest list.
It's a corner case however you look at it.

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

Python keywords have to be literal, though, don't they?

-- 
John Cowan  address@hidden  http://ccil.org/~cowan
If he has seen farther than others,
        it is because he is standing on a stack of dwarves.
                --Mike Champion, describing Tim Berners-Lee (adapted)




reply via email to

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