[racket] Is this a bug in contracts?
Is this a bug in contracts? When I ran the following code the
contract in onion% didn't give me an error, yet the contract is on an
"init sh" but the class doesn't have an "init sh" it has an
"init-field sh". See the line with the comment ;;;;;THIS LINE SHOULD
USE init-field not init
Thanks,
Harry
#lang racket
(define shish-D%
(class object% (super-new)
(abstract only-onions?)))
(define skewer%
(class shish-D% (super-new)
(define/override (only-onions?) #t)))
(define/contract onion%
(class/c [init (sh (is-a?/c shish-D%))]) ;;;;;THIS LINE SHOULD USE
init-field not init
(class shish-D% (super-new)
(init-field sh)
(define/override (only-onions?)
(and (send sh only-onions?) #t))))
(send (new onion% [sh (new onion% [sh (new skewer%)])]) only-onions?)