[plt-scheme] Equivalent to prop:procedure for scheme/class?
Hello Dave,
there is a generic way to attach structure properties to interfaces. Try this:
(define procedure<%>
(interface* () ([prop:procedure (λ (this . args) (send this apply . args))])
apply))
(define my-procedure%
(class* object% (procedure<%>)
(super-new)
(define/public (apply . args)
(printf "Hello, I'm ~a, and my apply method was called on ~s~%"
this args))
))
(define procedure
(new my-procedure%))
(procedure 1 2 3)
Ciao,
Thomas
--
When C++ is your hammer, every problem looks like your thumb.