There’s a neat paper Type Systems as Macros by Chang, Knauth, and Greenman [1] that describes how to implement a typed language using an untyped host language and macro expansion. The paper is neat, but I found the code hard to follow—the paper uses a compact notation that’s convenient for print, but not so much for reproducing on one’s own. This post is my attempt to implement and explain in more accessible terms what’s presented in the paper.| Lambda Land
There are a bunch of different ways of writing a macro in Racket. There are also some tricky things around phases to keep in mind. This is to help me keep them all straight. 3+1 ways to make a macro # This form: (define-syntax-rule(foo args ...)(use args ...)) is equivalent to: (define-syntax foo (syntax-rules()([foo args ...](use args ...)))) Which, is in turn equivalent to: (define-syntax foo (λ(stx)(syntax-case stx ()[(gensymed-foo args ...)#'(use args ...)]))); gensymed-foo is like foo b...| Technical Blog on Lambda Land
top contents ← prev up next → | docs.racket-lang.org