Revise doesn't work with macros?

It’s documented in the Limitations page:

Macros and generated functions
If you change a macro definition or methods that get called by @generated functions outside their quote block, these changes will not be propagated to functions that have already evaluated the macro or generated function.
You may explicitly call revise(MyModule) to force reevaluating every definition in module MyModule. Note that when a macro changes, you have to revise all of the modules that use it.

Revise.revise of course won’t work for a includet file because it’s not a tracked module.

Revise only makes it easier to do the same interactive evaluations you can manually run in the REPL, and despite the extra options for more reevaluations, that can never behave like reloading the session and evaluating everything from scratch. For example, you can’t successfully change the annotated type of a global variable. Redefinitions of methods called by other methods work smoothly because the call is not executed during definition. If you edit a method definition, previous calls are not reevaluated; the same applies to macro methods. Here’s a macro-less example:

foo() = 1
_foo::Int = foo()
bar() = _foo # instead of bar() = foo()

Even with __revise_mode__ = :eval, _foo::Int = foo() is not reevaluated when foo() = 2.3 is edited because its expression was not changed; if it was, it’d fail anyway.

4 Likes