Julia: Syntax error message on parametric macro

Created on 1 Aug 2017  ·  7Comments  ·  Source: JuliaLang/julia

No comment on what I was trying to do, but this error message is confusing, as it suggests you to write exactly what you already wrote, even though it is illegal syntax:

julia> dump(:(@(MyMacro{T}) expr))
ERROR: syntax: invalid macro use "@(MyMacro{T})"
error handling help wanted parser

Most helpful comment

Panda: eats, shoots, and leaves ... duh!

At first I wrote it without the parentheses:

julia> dump(:(@MyMacro{T} expr))
ERROR: syntax: invalid macro use "@(MyMacro{T})"

and so I naively thought the error message told me to add parentheses around it. I guess if I'm the only one who gets confused by this, it's alright, but maybe a near-synonym of "use" could be used in this context like invalid macro call or invalid macro name?

All 7 comments

It is not saying invalid macro, use "@(MyMacro{T})", but that difference is pretty subtle...

Panda: eats, shoots, and leaves ... duh!

At first I wrote it without the parentheses:

julia> dump(:(@MyMacro{T} expr))
ERROR: syntax: invalid macro use "@(MyMacro{T})"

and so I naively thought the error message told me to add parentheses around it. I guess if I'm the only one who gets confused by this, it's alright, but maybe a near-synonym of "use" could be used in this context like invalid macro call or invalid macro name?

Yes we can change it to invalid macro call.

invalid macro, call ... can we have something that does not end with an imperative?

julia> @Jeff{Bezanson}
ERROR: syntax: invalid macro call "@Jeff{Bezanson}"

I agree. Is invalid macro name, invalid macro statement, or invalid macro usage better?

invalid macro usage seems good to me. I'm also happy with deferring to calling Jeff but then his phone number should be in there too.

+1 for macro usage, -1 for including my phone number :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tkoolen picture tkoolen  ·  3Comments

felixrehren picture felixrehren  ·  3Comments

sbromberger picture sbromberger  ·  3Comments

dpsanders picture dpsanders  ·  3Comments

StefanKarpinski picture StefanKarpinski  ·  3Comments