Skip to content

Instantly share code, notes, and snippets.

@samth
Created July 6, 2012 15:21
Show Gist options
  • Select an option

  • Save samth/3060835 to your computer and use it in GitHub Desktop.

Select an option

Save samth/3060835 to your computer and use it in GitHub Desktop.
#lang racket/load
(module st racket
(define state (box 0))
(provide state))
(module m1 racket
(define l (list #'l))
(provide l))
(module m2 racket
(require (for-syntax 'm1 'st))
(define-syntax (mac stx)
#`(begin-for-syntax
(module* sub #f
(set-box! state (length #,(car l))))))
(provide mac))
(module m3 racket
(require 'm2)
(mac))
(module m4 racket
(require 'm3 (for-syntax 'st))
(begin-for-syntax
(dynamic-require '(submod 'm3 sub) #f)
(displayln state)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment