JuliaLang/julia

Improve documentation for `esc`

Open

#37.122 aperta il 19 ago 2020

Vedi su GitHub
 (4 commenti) (0 reazioni) (0 assegnatari)Julia (5773 fork)batch import
docsgood first issue

Metriche repository

Star
 (48.709 star)
Metriche merge PR
 (Merge medio 20g 6h) (157 PR mergiate in 30 g)

Descrizione

esc(e)

  Only valid in the context of an Expr returned from a macro. Prevents the macro hygiene pass from turning embedded variables into gensym variables. See the Macros section of the Metaprogramming chapter of the manual for more details and examples.

I'm not sure what "valid" really means here, since

julia> esc(:(x, ))
:($(Expr(:escape, :((x,)))))

It could mean "you can't eval the resulting expression":

julia> eval(esc(:(x, )))
ERROR: syntax: invalid syntax (escape (call (core tuple) (outerref x)))

Guida contributor