[racket] Defining a typed language

From: Konrad Hinsen (konrad.hinsen at fastmail.net)
Date: Fri Oct 17 08:25:38 EDT 2014

Sam Tobin-Hochstadt writes:
 > You should keep the original require and provide, and add the new inserted require as an
 > extra. Does that work?

That's easy to check:

-- test-lang/main.rkt ----------------------------
#lang typed-racket/minimal

(require typed/racket
         test-lang/more
         (only-in typed/racket
                  [#%module-begin tr:module-begin]
                  [require tr:require]))

(provide (except-out (all-from-out typed/racket) #%module-begin)
         (rename-out [module-begin #%module-begin])
         (all-from-out test-lang/more))

(define-syntax module-begin
  (syntax-rules (require)
    [(_ decl ...)
     (tr:module-begin
      (require test-lang/more)
      decl ...)]))
--------------------------------------------------

But now I am back to my original error message:

  ; test-lang/more.rkt:4:9: Type Checker: missing type for identifier;
  ;  consider using `require/typed' to import it
  ;   identifier: bar
  ;   from module: test-lang/more
  ;   in: bar

My new friend, the Macro Stepper, now says about 'bar':

  Apparent identifier binding
  in phase 0:
    defined in: test-lang/more
      as: bar.4
    imported from: test-lang/main

Konrad.

Posted on the users mailing list.