[racket-dev] set! and provided macros

From: J. Ian Johnson (ianj at ccs.neu.edu)
Date: Thu Nov 1 12:24:30 EDT 2012

If a macro provided by a module uses set! in its expansion, then a use in another module will cause a "cannot mutate module-required identifier" error, even if the identifier is not provided. It's easy enough for me to write a setter function and expand to that.

I can see that it is undecidable in general to determine if a macro will expand into a set! of a module's identifier so that the "no set!" optimizations would be completely killed.
I would like to see a different error in this case (e.g. "set! in foreign module macro expansions prohibited"), if that is an easily detected case, that is.


Posted on the dev mailing list.