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

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.

Here are two alternative formulations of keywords, both based on the
idea that keywords are pure syntax, with no representation at run time.

1) Keyword-value arguments are sorted into order corresponding to
the alphabetical order of the keywords.  Thus  (foo 'bar foo: 32 bar: 54)
comes out at run time as (foo 'bar 54 32).  Similar treatment is
given to keywords in lambda lists.  (Note: forcer came up with this
one independently.)

2) Keywords are syntactic sugar for a single argument in the form of an
a-list.  This maps (foo 'bar foo: 32 bar: 54) to
(foo 'bar '((foo: . 32) (bar: . 54))).  Keywords in lambda lists are
initialized by unpacking the a-list when the procedure is invoked.

John Cowan                                <cowan@ccil.org>
Yakka foob mog.  Grug pubbawup zink wattoom gazork.  Chumble spuzz.
    -- Calvin, giving Newton's First Law "in his own words"