[racket] struct-copy parent fields with provide/contract'ed struct

From: Nadeem Abdul Hamid (nadeem at acm.org)
Date: Sat Jul 16 12:53:26 EDT 2011

Am I missing something, or is this a bug?
The following works as expected:

Welcome to DrRacket, version 5.1.2.3--2011-07-13(41b66d3/a) [3m].
Language: racket; memory limit: 128 MB.
> (module yup racket
    (struct a (x y) #:transparent)
    (struct b a (z) #:transparent)
    (provide (struct-out a) (struct-out b)))
> (require 'yup)
> (struct-copy b (b 1 2 3) [z 6] [x #:parent a 2])

(b 2 2 6)


However, with provide/contract instead gives an error:

> (module yup racket
    (struct a (x y) #:transparent)
    (struct b a (z) #:transparent)
    (provide/contract
      [struct a ((x number?) (y number?))]
      [struct (b a) ((x number?) (y number?) (z number?))]))
> (require 'yup)
> (struct-copy b (b 1 2 3) [z 6] [x #:parent a 2])

. struct-copy: identifier not bound to a parent struct in: a
   (with "a" highlighted in the [x #:parent a 2] expression)



--- nadeem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20110716/916aaf75/attachment.html>

Posted on the users mailing list.