About the interpretation "@" by Macro

I have a macro defined as follows:

macro A(x…)
x
…(other codes)
end
When I called “@A code@W”, the input x was interpreted by @A as two elements of [:code, :W], how can I prevent “@” from interpretation?

This doesn’t make it apparent what you’re trying to do, so provide a MWE that shows the error and clarifies your intended output, and put code in triple backtick ``` blocks. It may help to review the guidelines here.

1 Like

Also note that macros operate on parsed expressions and thus cannot change parsing. Hence macros can only turn syntactically Julia code into other syntactically valid code.

There are no reader macros in Julia. The thing that comes closest are string macros.

A general word of warning: You almost never need macros. It always preferred to implement the functionality with function and just make small convenience wrapper with macros to make usage easier (if applicable).

So circling back around: why don’t you describe what you actually want to achieve as @Benny suggested? Then we can help you find the most effective approach :slight_smile: