[racket] Is this a bug in contracts?

From: Harry Spier (vasishtha.spier at gmail.com)
Date: Wed Jan 16 19:39:32 EST 2013

On Mon, Jan 14, 2013 at 9:27 AM, Matthias Felleisen
<matthias at ccs.neu.edu> wrote:
>
> And Harry, do define certain contracts separately, e.g.,
>
> (define shish/c (is-a?/c shish-D%))
>

If my class has a field of the same class is there a way to do that?

I.e. both case 1 and case 2 fail on undefined identifier
Case 1
#lang racket
(define pizza-D%/c (is-a?/c pizza-D%))

(define/contract pizza-D%
  (class/c [init-field (p pizza-D%/c)])
  (class pizza-D% (super-new)
  (init-field p)))

Case 2
#lang racket
(define/contract pizza-D%
  (class/c [init-field (p pizza-D%/c)])
  (class pizza-D% (super-new)
  (init-field p)))

(define pizza-D%/c (is-a?/c pizza-D%))

Thanks,
Harry Spier

Posted on the users mailing list.