[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 88 from before July 7th, 2015. The new archives for SRFI 88 contain all messages, not just those from before July 7th, 2015.

On 12-Apr-06, at 10:28 AM, John Cowan wrote:

Marc Feeley scripsit:

1) find an alternative mechanism that avoids the need for keyword
objects (i.e. you view foo: as a symbol and want to keep it that way)

Yes, though I am obviously okay with allowing such symbols to be

2) find an alternative mechanism that avoids the proposed parameter
list syntax (with #!key, etc)

No, although I don't consider this essential, since my approaches
all involve a standardized run-time representation.

3) find an alternative implementation of the SRFI (i.e. you are OK
with the specification)


OK, then please explain why in your proposal #2 the compiler needs to transform:

   (foo 'bar foo: 32 bar: 54)


   (foo 'bar (list (cons foo: 32) (cons bar: 54)))

For your purposes, wouldn't it be sufficient to use a rest parameter in the definition of foo and parse that in foo?

   (define (foo a . rest)
     (let ((optionals (alistify rest)))

Note that this is what the reference implementation of SRFI 89 does. Then there is no need for the compiler to treat keywords specially (except they need to be self evaluating).

Also, consider the function definition:

   (define (f a b #!key (y 11) (z 22)) ...)

and the call:

   (f x: 33 z: 44 y: 55)

In this case, I want parameter a to be bound to x: and b to be bound to 33. I don't see how this would work with your proposals.

In summary, I fail to understand which problem you are trying to solve with proposal #2. I also don't understand proposal #3.