What is unescape in v0.7?


#1

I was looking into the doc system, but I’m quite confused with the v0.7’s doc macro:

# docsystem basics
const unescape = Symbol("hygienic-scope")
macro doc(x...)
    docex = atdoc(__source__, __module__, x...)
    isa(docex, Expr) && docex.head === :escape && return docex
    return Expr(:escape, Expr(unescape, docex, typeof(atdoc).name.module))
end

Is there anyone who could explain a little bit about what is an unescape?


#2

FYI, the doc says:

Macro hygiene is represented through the expression head pair escape and hygienic-scope. The result of a macro expansion is automatically wrapped in (hygienic-scope block module), to represent the result of the new scope. The user can insert (escape block) inside to interpolate code from the caller.


#3

I still don’t get it. Anyone could explain more about what unescape do here?


#4

I guess that’s something related to macro hygiene, see this issue: https://github.com/JuliaLang/julia/pull/27314