Created
August 19, 2015 19:58
-
-
Save ktakashi/21cad1d7b363908e68a5 to your computer and use it in GitHub Desktop.
Macro phasing
This file contains hidden or 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
(import (except (rnrs) cons) | |
(for (only (rnrs) cons syntax-case lambda | |
display newline syntax) expand (meta 2))) | |
(define-syntax foo | |
(lambda (x) | |
(define-syntax expand-phase | |
(lambda (x) | |
(display (cons 1 2)) (newline) | |
#'#t)) | |
(expand-phase) | |
#'#t)) | |
(foo) | |
;; prints (1 . 2) | |
(display (cons 'a 'b)) (newline) | |
;; should be an error | |
#| | |
error: | |
Racket (plt-r6rs) | |
NMosh (Andre van Tonder expander) | |
Larceny (ditto) | |
ok: | |
Chez | |
Mosh (psyntax) | |
Ypsilon | |
Sagittarius | |
|# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment