How does one attach a generic interface to a class?

`class*` allows one to attach an `interface` [2] (in the class sense of that 
term, which I understand is separate from that of "generic interface"). 

Then the docs for `interface*` show an example attaching the 
`prop:custom-write` property. [3] But the docs for `prop:custom-write` say that 
it's deprecated, and one should "use `gen:custom-write`, instead" [4] (that is, 
the generic-interface version this concept).

Yet I when I put `gen:custom-write` into `interface*`, it triggers an "illegal 
use of syntax" error.

#lang racket

(define i<%> (interface* () ([gen:custom-write
                              (lambda (obj port mode) (void))])
               method1 method2 method3))

So I'm not clear whether I'm doing it wrong, or if `interface*` only works with 
the (deprecated) property-based technique.



[2] 
http://docs.racket-lang.org/reference/createinterface.html?q=class*#%28form._%28%28lib._racket%2Fprivate%2Fclass-internal..rkt%29._interface%29%29
 
<http://docs.racket-lang.org/reference/createinterface.html?q=class*#(form._((lib._racket/private/class-internal..rkt)._interface))>

[3] 
http://docs.racket-lang.org/reference/createinterface.html?q=class*#%28form._%28%28lib._racket%2Fprivate%2Fclass-internal..rkt%29._interface%2A%29%29
 
<http://docs.racket-lang.org/reference/createinterface.html?q=class*#(form._((lib._racket/private/class-internal..rkt)._interface*))>

[4] 
http://docs.racket-lang.org/reference/Printer_Extension.html?q=class*#%28def._%28%28quote._~23~25kernel%29._prop~3acustom-write%29%29
 
<http://docs.racket-lang.org/reference/Printer_Extension.html?q=class*#(def._((quote._~23~25kernel)._prop~3acustom-write))>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to