[racket] Submodules can't be imported in same file?

From: Greg Hendershott (greghendershott at gmail.com)
Date: Fri Sep 5 18:29:27 EDT 2014

The following approach works for me. Would that do what you need?

;; ----- mod.rkt -----
#lang racket

(module private racket
  (define (secret)
    'foo)
  (provide secret))

(require 'private)

(define (wrapper)
  (secret))

(provide (all-defined-out))
;; Note that all-defined-out will not provide stuff from 'private.
;; For that to happen, you would need to use (require (all-from-out
;; 'private)). So ... don't do that.


;; ----- use-mod.rkt -----
#lang racket

(require "mod.rkt")
(wrapper) ;; => 'foo
(secret)  ;; => error -- as desired

Posted on the users mailing list.