On Jul 4, 2009, at 11:47 PM, Derick Eddington wrote:
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
Yes, this is a flaw.
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.
I thought keywords were already tagged with something like this.
When did you switch to using quote for tagging?
define/kw could still define macros which recognize (:- kw) syntax but
the expand-time processing would still be inconsistent with the run-
time
processing.
Why?
So I think I'm going to drop the expand-time processing
altogether and make define/kw simply use lambda/kw.
Aren't you giving up too fast! :-)
Aziz,,,