
Would it be possible to statically track which macros are unhygienic and the extra bindings they introduce? (e.g. struct
)

What do you mean by “statically”?

I suppose that could mean “by looking at the macro itself without knowing in what contexts it is used”

By “statically” I mean, determining hygiene at the macro’s compile time, if that makes sense.

Although, now that I think about it, the fact that Racket macros can perform arbitrary computation probably makes it difficult to perform any kind of static analysis on them. Though, such things are far outside my current knowledge, so that’s entirely speculative.

In general you won’t be able to say much of course, but if the macro is constrained is some ways, I’m pretty sure there are many simple and useful cases that can be easily proven to be hygienic.

There’s some research on this, such as https://www.ccs.neu.edu/home/dherman/research/papers/dissertation.pdf and https://doi.org/10.1017/S0956796816000137

It looks like I have some reading to do :smile:

This is impressively clearly written!