[plt-scheme] Keyword args

From: Paul Schlie (schlie at comcast.net)
Date: Fri Oct 22 10:29:44 EDT 2004

If at all possible, please consider adoption of a more visually associative
keyword syntax, as although I know scheme uses a prefix syntax, prefixing
vs. appending a colon to a keyword to me is akin to spelling it backward, as
although scheme's language syntax is prefix, it doesn't attempt to change
the natural left-to-right spelling of symbols as they would appear in their
natural languages, so although I know it's a personal preference thing, I
just wanted to voice a strong opinion in favor of something more like that
which would allow keyword expressions to be formed with either appended
colons, and/or possibly just simple pairs:

(some-function x: 1 y: 2)


(some-function (x 1) (y 2))


(some-function (x: 1) (y: 2))   ; to even emphasize the point


(some-function (: x 1) (: y 2))


(some-function :x 1 :y 2)

As for whatever reason, I still can't help finding it visually disturbing,
and contradicting my instinctive expectations of a colon appearing between
associated elements, prefixing the keyword just doesn't feel reasonable.

> Eli Barzilay wrote:
>> On Oct 21, Noel Welsh wrote:
>> I want keyword args for SchemeUnit 2.0 but I don't see the
>> point of reinventing an implementation when both the object
>> system and Swindle use 'em.  Following this theme of
>> laziness, does either implementation provide an reusable
>>  library that doesn't require me to use their respective
>> object systems?
> Swindle's "base.ss" will give you that (and almost only that):
> > (require (lib "base.ss" "swindle"))
> > ((lambda (&keys x y) (list x y)) :y 1 :x 2)
> (2 1)
> You need to use it as a language module though, since it redefines
> #%top to make self-quoting :keywords, as well as redefining `lambda'
> etc.

Posted on the users mailing list.