Why do variables start with C # in a macro named Julia Mountain?

I'm just learning macros, and I'm confused about how it is possible for a variable name to start with C #, but this is exactly what the macro seems to do successfully. For example, if I want to set a variable equal to 4:

macro testMacro(sym)
  esym = esc(sym)
  quote
    temp = 4
    $esym = temp
    return
  end
end

Then

julia> macroexpand(:(@testMacro α))
quote  # none, line 4:
    #132#temp = 4 # line 5:
    α = #132#temp # line 6:
    return
end

julia> @testMacro α

julia> α
4

Please note that the temporary variable is called # 132 # temp, and I understand that it will be evaluated in REPL just like that. However, this seems impossible, as the whole line should now be technically a comment.

If I look at the first expression inside the macro, I get what I cannot reproduce.

julia> macroexpand(:(@testMacro α)).args[2]
:(#132#temp = 4)

julia> ex = :(#132#temp = 4)


ERROR: syntax: incomplete: premature end of input

? , . 1.) , ( ), #? 2.) , julia ?

+4
1

?

, , , . ( esc)

1.) , ( ), #?

, , . :

julia> eval(Expr(:(=), symbol("#s"), 1))
1

julia> whos()
#s                            Int64
Base                          Module
Core                          Module
LastMain                      Module
Main                          Module
ans                           Int64

julia> eval(symbol("#s"))
1

2.) , julia ?

, . , Symbol , #, .

+11

All Articles