My current keywords design is flawed.  Eli Barzilay pointed out that
using symbols for keywords makes run-time-processed keywords susceptible
to bugs where argument values are mistaken for keywords.  E.g.:

(define (something) 'foo)
(define/kw (f (foo) . r) (list foo r))
(f 'foo "intended" "extra" (something) "extra")
=> ("intended" ("extra" foo "extra"))
((values f) 'foo "intended" "extra" (something) "extra")
=> ("extra" ("extra"))  ;; not what was desired

I was already uncomfortable about the other inconsistencies between
expand-time and run-time processing shown in my previous post.

Run-time processing needs keywords to be a distinct type.  So now I'm
considering:

(define/kw (f x y (a) (b :boolean) . r) (list x y a b r))
(f 1 2 3 (:- b) 4 (:- a) 5 6)
=> (1 2 5 #T (3 4 6))

where :- creates instances of a distinct keyword type at run-time.

define/kw could still define macros which recognize (:- kw) syntax but
the expand-time processing would still be inconsistent with the run-time
processing.  So I think I'm going to drop the expand-time processing
altogether and make define/kw simply use lambda/kw.  Making the
expand-time processing, and making it use the same parser as the
run-time, was a fun challenge, so I'm glad I did it.

I might also make repeated keywords disallowed.

-- 
: Derick
----------------------------------------------------------------

Reply via email to