Last active
August 14, 2018 21:43
-
-
Save LeifAndersen/8c0a8c1722faabad5ee0c04221fc7e98 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#lang racket | |
(define x 5) | |
(define-for-syntax (forge-identifier modpath sym) | |
(define ns (make-base-empty-namespace)) | |
(parameterize ([current-namespace ns] | |
[current-module-declare-name modpath]) | |
(eval #`(module dummy racket/base | |
(define #,sym 'dummy) | |
(provide #,sym))) | |
(namespace-require modpath) | |
(namespace-syntax-introduce (datum->syntax #f sym) | |
(module->namespace modpath)))) | |
(define-syntax (f stx) | |
(define the-x | |
(forge-identifier (variable-reference->resolved-module-path (#%variable-reference)) | |
'x)) | |
#`(list #,the-x x)) | |
(f) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment