[plt-scheme] struct inheritance and scheme/contract

From: YC (yinso.chen at gmail.com)
Date: Thu Feb 25 01:31:16 EST 2010

Hi all -

I encountered a strange error in 4.2.3 - it seems that provide/contract and
inherited structs might have some conflicts.  Below I have a 3 layer struct
inheritance, done in different files.  If I change the last file's
(provide/contract ...) to (provide (struct-out ...)) then it works, but
otherwise it throws a strange error "provide/contract: expected field name
to be nner, but found inner in: inner".

Any thoughts are appreciated.  Thanks,
yc

;; --- base.ss
#lang scheme/base
(require scheme/contract
         )
(define-struct kvs (inner) #:mutable)

(provide/contract
 (struct kvs ((inner any/c)))
 )

;; -- mime.ss
#lang scheme/base
(require "base.ss"
         scheme/contract
         )

(define-struct (mime kvs) (body))

(provide/contract
 (struct mime ((inner any/c)
               (body any/c)))
 )

;; -- content.ss ;; throw error "provide/contract: expected field name to be
nner, but found inner in: inner"
#lang scheme/base
(require scheme/contract
         "mime.ss"
         "base.ss"
         )

(define-struct (content mime) (test))

(provide/contract
 (struct content ((inner any/c) ;; error occurs here - "provide/contract:
expected field name to be nner, but found inner in: inner"
                  (body any/c)
                  (test any/c)))
 )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20100224/8ab2d7dc/attachment.html>

Posted on the users mailing list.