Skip to content

Conversation

@jw3126
Copy link
Contributor

@jw3126 jw3126 commented Mar 4, 2019

Towards #26919
I would also like to add a docstring for QuoteNode. But despite reading this it is not clear to me:

  • What the difference between the difference between Expr(:quote,...) and QuoteNode is
  • Why these are two such concepts
  • When to use which

@kshyatt kshyatt added the docs This change adds or pertains to documentation label Mar 4, 2019
@JeffBezanson
Copy link
Member

The metaprogramming manual section on QuoteNode explains it --- :quote Exprs will do interpolation, so they are like scheme quasiquote, and QuoteNode does not do interpolation.

@jw3126
Copy link
Contributor Author

jw3126 commented Mar 13, 2019

Yeah, I read that section, but I still don't get it. Also I am not very familiar with scheme.
Can you give an example, what it means that one supports interpolation and the other not?

@jw3126
Copy link
Contributor Author

jw3126 commented Mar 13, 2019

Ok I think I get the difference now:

julia> quot(Expr(:$, :(1+2))) |> eval
3

julia> QuoteNode(Expr(:$, :(1+2))) |> eval
:($(Expr(:$, :(1 + 2))))

@JeffBezanson
Copy link
Member

Correct. :quote is used for the syntax quote ... end or :( ... ), which perform $ interpolation.

@jw3126
Copy link
Contributor Author

jw3126 commented Apr 13, 2019

I think this is ready.

@jw3126
Copy link
Contributor Author

jw3126 commented Apr 19, 2019

bump

Copy link
Member

@fredrikekre fredrikekre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but please add the # Examples headers before doctests in the docstrings.

@jw3126
Copy link
Contributor Author

jw3126 commented May 4, 2019

Merge?

@fredrikekre fredrikekre merged commit 9b5fea5 into JuliaLang:master May 4, 2019
fredrikekre added a commit that referenced this pull request May 6, 2019
ararslan pushed a commit that referenced this pull request May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs This change adds or pertains to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants