[racket] Contracts and submodules

From: Harry Spier (vasishtha.spier at gmail.com)
Date: Thu Nov 29 19:59:28 EST 2012

Dear list members,

Case 1 below doesn't give a contract violation but case 2 does.  Is
this desired behavour or is it a bug?

In DrRacket
Case 1
---------
#lang racket
(provide (contract-out [ident-number (-> number? number?)]))
(define (ident-number x)  x)
(module+ main
  (ident-number 'a))

> 'a


Case 2
------------
#lang racket
(provide (contract-out [ident-number (-> number? number?)]))
(define (ident-number x)  x)
(module+ main
  (require (submod ".."))
  (ident-number 'a))

>
 ident-number: contract violation
 expected: number?
 given: 'a
 in: the 1st argument of
      (-> number? number?)
 contract from:
      c:\users\harry\ocr_project\test2.rkt
 blaming:
      (c:\users\harry\ocr_project\test2.rkt main)
 at: c:\users\harry\ocr_project\test2.rkt:2.24

Thanks,
Harry Spier

Posted on the users mailing list.