
I sent a post to the mailing list about the guarded-block
macro. I’m trying to make it more extensible but I hit some macrology issues and I’m looking for advice https://groups.google.com/g/racket-users/c/H-EppBmQ7oU/m/chEItxUGBwAJ

I suppose guard-block
is the real macro that does the work, while guard
is just a “dummy” form that guard-block
will recognize it by its binding. Is that correct?

local-expand
could work, but it looks really heavyweight. Another possibility is doing something similar to match expander (https://github.com/racket/racket/blob/master/racket/collects/racket/match/match-expander.rkt#L8)

Yup, guard
doesn’t do anything on its own, guard-block
just searches for it

I don’t really want to have to create some sort of define-guard-expander
form though

I’d rather just write regular macros with define-simple-macro
that happen to expand into guard
statements

Then, another similar macro that you might want to look into is define/private
, which expands to (private ...)
and (define ...)
.
(define ...)
is also recognized specially (just like your guard
) inside class
.

class
does seem similar


(list+ 1 (define x 2) (add1 x))
=> '(1 3)

oooo interesting

that does seem relevant

This thread may also be useful to you: https://www.mail-archive.com/racket-users@googlegroups.com/msg44445.html