Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Trouble with state and module-begin
#lang racket/load
(module st racket
(define is-typed? (box #f))
(define type-env (box 0))
(provide is-typed? type-env))
(module mac racket
(require (for-syntax 'st))
(define-syntax (m stx)
(unless (> (unbox type-env) 0)
(displayln ">> type-env is 0")
(error 'fail))
#'#t)
(provide m))
(module lang racket
(require (for-syntax 'st))
(provide (rename-out [mb #%module-begin])
(except-out (all-from-out racket) #%module-begin))
(define-syntax (mb stx)
(displayln ">> in module-begin")
(set-box! is-typed? #t)
(syntax-case stx ()
[(_ forms ...)
#'(#%module-begin
forms ...
(begin-for-syntax
(when (unbox is-typed?)
(set-box! type-env 1))))])))
(module A1 'lang
(require (for-syntax 'st))
(require 'mac)
(module+ sub
0
(m)))
(require 'A1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.