[racket] Re-providing contracted structs?

From: J. Ian Johnson (ianj at ccs.neu.edu)
Date: Wed Jul 20 20:42:05 EDT 2011

I have a strange bug I can't figure out dealing with re-providing a struct that was contracted in my require.

Module A:
Firstly, I have a specific contract for my struct:
(provide/contract (struct mystruct ([field integer?])))

I have another part of A I will contract later:
(provide a)

I have several other modules that give a, b and c in module A different contracts, but only slightly, so I have a macro for it in module A.

(define-syntax-rule (myprovide param)
 (begin (provide/contract [a param])
        (provide (struct-out mystruct))))

Module B:
[require module A]

(myprovide any/c)

struct-out: no binding for structure-type identifier at: mystruct in: (struct-out mystruct)

This works if Module A just does (provide (struct-out mystruct)), but I don't want that.
Is it really the case that I can't re-export this struct using struct-out, or is there a bug in provide/contract?


Posted on the users mailing list.