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

Re: Alternative formulations of keywords

This page is part of the web mail archives of SRFI 89 from before July 7th, 2015. The new archives for SRFI 89 contain all messages, not just those from before July 7th, 2015.

Marc Feeley scripsit:

> How is foo going to determine which parameters were supplied?  Are  
> you assuming that the compiler has some knowledge about foo so that  
> it knows the complete set of named optional parameters and can pass  
> the "unsupplied value" for the parameters that are not supplied?    

Just so.

> In general this is impossible because the function to call may be  
> computed, as in:

I agree that my proposal #1 will not work when the function to be
called is not known at compile time.  However, I don't mind if it
doesn't work in every case, since the equivalent form for which the
keywords are a shorthand is always well-defined, if awkward.

If you are familiar with Prolog, I'm suggesting something vaguely
analogous to the use of DCG clauses.

> For the second proposal you have to assume the general case where you  
> are passing computed expressions, such as:
>    (foo 'bar foo: (f x) bar: (g x))
> which would have to be transformed into
>    (foo 'bar (list (cons 'foo: (f x)) (cons 'bar: (g x))))

Or equivalently to (foo 'bar `((foo: . ,(f x)) (bar: . ,(g x)))).

We pledge allegiance to the penguin             John Cowan
and to the intellectual property regime         cowan@ccil.org
for which he stands, one world under            http://www.ccil.org/~cowan
Linux, with free music and open source
software for all.               --Julian Dibbell on Brazil, edited