Skip to content

Instantly share code, notes, and snippets.

@samth samth/weird.rkt
Last active Aug 29, 2015

What would you like to do?
#lang racket
(module evaluator racket
;; Allow evaluation at phase1
(require (for-syntax racket/base syntax/parse))
(provide phase1-phase0-eval phase1-phase0-run)
(define-namespace-anchor anchor)
(define namespace (namespace-anchor->empty-namespace anchor))
(define-syntax phase1-phase0-run
[(_ form:expr ...)
#'(let-syntax ([go (lambda (stx) form ...)]) (go))]))
(define-syntax phase1-phase0-eval
[(_ form:expr ...)
#'(eval-syntax (quote-syntax (phase1-phase0-run form ...)) namespace)])))
(module f racket
(require (submod ".." evaluator))
(provide f)
(define (f) (phase1-phase0-eval (display "hello") #'#f)))
(define ns (make-base-namespace))
(current-namespace ns)
(require syntax/location)
(define name (quote-module-path f))
;(dynamic-require name 0)
((dynamic-require name 'f))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.