Created
March 17, 2015 17:04
-
-
Save tomasaschan/81eaa3ea63b6f044fe84 to your computer and use it in GitHub Desktop.
Macro name mangling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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