JuliaLang/julia

Improve documentation for `esc`

Open

#37,122 创建于 2020年8月19日

在 GitHub 查看
 (4 评论) (0 反应) (0 负责人)Julia (5,773 fork)batch import
docsgood first issue

仓库指标

Star
 (48,709 star)
PR 合并指标
 (平均合并 20天 6小时) (30 天内合并 157 个 PR)

描述

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

贡献者指南