I have a file "exceptions.rkt"
#lang racket
(module exceptions racket
(provide Macro/Raise Macro/Assert Macro/Assert* Macro/Domain-Assert)
; ... Definitions for provided symbols...
) ; End of module, end of file
Macro/Raise etc are not actually macros defined with define-syntax, they're just unary functions generated with syntax-rules and assigned a name
(define Macro/Raise
(syntax-rules ()
; ... body not important ...
))
and in the same folder as "exceptions.rkt", I have a file "tables.rkt".
#lang racket
(module tables racket
(require "exceptions.rkt")
(define-syntax Assert Macro/Assert)
; ... more stuff...
) ; End of module, end of file
but this results in Macro/Assert: undefined; cannot reference an identifier before its definition in module: 'tables phase: 1
I've tried reading the doc and can't figure out what I'm doing wrong... So what am I doing wrong?
In order for definitions to be usable during the macro definition phase, use for-syntax:
(require (for-syntax "exceptions.rkt"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With