Skip to content

Commit

Permalink
Document QuoteNode
Browse files Browse the repository at this point in the history
  • Loading branch information
jw3126 committed Mar 15, 2019
1 parent 74ff95e commit b21d1e6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
7 changes: 7 additions & 0 deletions base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2178,4 +2178,11 @@ The base library of Julia. `Base` is a module that contains basic functionality
"""
Base.Base

"""
QuoteNode
A quoted piece of code, that does not support interpolation. See the [manual section about QuoteNodes](@ref man-quote-node) for details.
"""
QuoteNode

end
1 change: 1 addition & 0 deletions doc/src/base/base.md
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,7 @@ Meta.@lower
Meta.parse(::AbstractString, ::Int)
Meta.parse(::AbstractString)
Meta.ParseError
Core.QuoteNode
Base.macroexpand
Base.@macroexpand
Base.@macroexpand1
Expand Down
10 changes: 8 additions & 2 deletions doc/src/manual/metaprogramming.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,9 +328,15 @@ Expr
As we have seen, such expressions support interpolation with `$`.
However, in some situations it is necessary to quote code *without* performing interpolation.
This kind of quoting does not yet have syntax, but is represented internally
as an object of type `QuoteNode`.
The parser yields `QuoteNode`s for simple quoted items like symbols:
as an object of type `QuoteNode`:
```jldoctest interp1
julia> quot(Expr(:$, :(1+2))) |> eval
3
julia> QuoteNode(Expr(:$, :(1+2))) |> eval
:($(Expr(:$, :(1 + 2))))
```
The parser yields `QuoteNode`s for simple quoted items like symbols:
```jldoctest interp1
julia> dump(Meta.parse(":x"))
QuoteNode
Expand Down

0 comments on commit b21d1e6

Please sign in to comment.