diff --git a/pitfall/restructure/generic-interface-example.rkt b/pitfall/restructure/generic-interface-example.rkt new file mode 100644 index 00000000..fa42e38a --- /dev/null +++ b/pitfall/restructure/generic-interface-example.rkt @@ -0,0 +1,20 @@ +#lang br +(require data/collection racket/private/generic-methods) + +(define countable<%> + (interface* () + ([(generic-property gen:countable) + (generic-method-table gen:countable + (define (length o) + (send o length)))]))) + + +(define c (class* object% (countable<%>) + (super-new) + (define/public (length) 42))) + +c + +(define o (make-object c)) + +(length o) \ No newline at end of file