
Also, there’s a macro that does something like define-syntax-rule
, but uses syntax-parse
’s functionality: define-syntax-parse-rule
.
(require syntax/parse/define)
(define-syntax-parse-rule
(dada-test
place-term
({~literal true-when} read-holds-atomic-term ...)

There’s also the option of having your dada-test
macro use Racket keywords for these, like #:true-when
and #:false-when
. As a matter of taste you might love or hate how they look, or you might not care either way. But they’re unambiguously keywords.

PS for #:literals
from syntax-parse
the keywords need bindings for-syntax
; if you don’t care about that, use #:datum-literals
instead.

IIUC, those literals should not be required for-syntax
. But they do need to be require
d normally and cannot be unbound. Their bindings are compared at phase 0 (which is the runtime one).

Ah, yes, perhaps it’s just define-syntax
at phase–0—that seems closer to what I’m remembering

+1. It also works for normal define
but using define-syntax
can generate error messages for out-of-context uses.

I really like ~literal
over #:literals
, but there is a difference: ~literal
allows the id to be unbound. When the id is unbound, the id used in macro invocation must also be unbound, but with the same name

So they are really merely compared by free-identifier=?
!

apparently