Skip to content

Commit abce53a

Browse files
committed
Document QuoteNode
1 parent 06c4e42 commit abce53a

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

base/docs/basedocs.jl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,4 +2178,11 @@ The base library of Julia. `Base` is a module that contains basic functionality
21782178
"""
21792179
Base.Base
21802180

2181+
"""
2182+
QuoteNode
2183+
2184+
A quoted piece of code, that does not support interpolation. See the [manual section about QuoteNodes](@ref man-quote-node) for details.
2185+
"""
2186+
QuoteNode
2187+
21812188
end

doc/src/base/base.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ Meta.@lower
397397
Meta.parse(::AbstractString, ::Int)
398398
Meta.parse(::AbstractString)
399399
Meta.ParseError
400+
Core.QuoteNode
400401
Base.macroexpand
401402
Base.@macroexpand
402403
Base.@macroexpand1

doc/src/manual/metaprogramming.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,15 @@ Expr
328328
As we have seen, such expressions support interpolation with `$`.
329329
However, in some situations it is necessary to quote code *without* performing interpolation.
330330
This kind of quoting does not yet have syntax, but is represented internally
331-
as an object of type `QuoteNode`.
332-
The parser yields `QuoteNode`s for simple quoted items like symbols:
331+
as an object of type `QuoteNode`:
332+
```jldoctest interp1
333+
julia> quot(Expr(:$, :(1+2))) |> eval
334+
3
333335
336+
julia> QuoteNode(Expr(:$, :(1+2))) |> eval
337+
:($(Expr(:$, :(1 + 2))))
338+
```
339+
The parser yields `QuoteNode`s for simple quoted items like symbols:
334340
```jldoctest interp1
335341
julia> dump(Meta.parse(":x"))
336342
QuoteNode

0 commit comments

Comments
 (0)