JuliaLang/julia

Improve documentation for `esc`

Open

#37,122 opened on 2020年8月19日

GitHub で見る
 (4 comments) (0 reactions) (0 assignees)Julia (5,773 forks)batch import
docsgood first issue

Repository metrics

Stars
 (48,709 stars)
PR merge metrics
 (平均マージ 20d 6h) (30d で 157 merged PRs)

説明

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)))

コントリビューターガイド