Skip to content

Instantly share code, notes, and snippets.

@tomasaschan
Created March 17, 2015 17:04
Show Gist options
  • Select an option

  • Save tomasaschan/81eaa3ea63b6f044fe84 to your computer and use it in GitHub Desktop.

Select an option

Save tomasaschan/81eaa3ea63b6f044fe84 to your computer and use it in GitHub Desktop.
Macro name mangling
julia> macro maketype(name)
println(name, " <: ", typeof(name))
q = quote
immutable $name
v
end
$name(a,b) = $name(a + b)
end
println(q)
q
end
julia> @maketype Foo
Foo <: Symbol
begin # none, line 3:
immutable Foo # line 4:
v
end # line 6:
Foo(a,b) = begin # none, line 6:
Foo(a + b)
end
end
#18#Foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment