[plt-scheme] first-class methods
Someone may have explained this to me once, but I can't remember. Why
can't public methods be passed as first-class values inside the class
definition?
(define my-class%
(class object%
(public purple? foo)
(define (purple? x)
(eq? x 'purple))
(define (foo ls)
(filter purple? ls))
(super-new)))
*** class: misuse of method (not in application) in: purple?
(If you don't make purple? public, this works.) It looks to me like you
could make this work by having method declarations expand both to their
current implementation and to an identifier macro that expands purple?
in argument position to (lambda args (apply purple? args)). Why wouldn't
this work?
Thanks,
Dave