[plt-scheme] Equivalent to prop:procedure for scheme/class?

From: Dave Gurnell (d.j.gurnell at gmail.com)
Date: Mon Mar 1 04:17:40 EST 2010

Excellent stuff - many thanks!

I had no idea that gem existed. 

-- Dave

On 28 Feb 2010, at 23:12, Thomas Chust wrote:

> 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



Posted on the users mailing list.