Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Segfault & bad error message in splices #1272

Closed
pao opened this Issue · 4 comments

4 participants

@pao
Collaborator

Clearly, the $ prefix is well within the quote block (this is missing parens, though). Then there's the segfault.

julia> test(x) = quote
           $x($x)
       end

julia> test(:())
syntax error: prefix $ outside of quote block

julia> test(:())
syntax error: prefix $ outside of quote block

julia> test(:())
Segmentation fault (core dumped)
@pao
Collaborator

I can actually get the segfault if this happens to be the right error message, too.

julia> test(x) = $x

julia> test(:())
syntax error: prefix $ outside of quote block

julia> test(:())
syntax error: prefix $ outside of quote block

julia> test(:())
Segmentation fault (core dumped)
@toivoh
Collaborator

@pao: The second $ is actually outside the quote block. Your example is equivalent to

julia> test(x) = quote
           $(x($x))
       end

since interpolation in expressions is greedy. Interpolation (tries to) evaluate the argument x($x) outside of the quote block, and then use the result in building the AST.

@StefanKarpinski

Greedy splicing strikes again.

@pao
Collaborator

Sure--I did say it was missing parens--but nothing in the error message indicates that that's what's going on, which was my point. There's two $'s in that expression, and both of them are contained in the quote block. Not knowing which one is wrong, or why, is why the error message is bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.