Created
July 2, 2018 08:40
-
-
Save bhelyer/0e390e27a71afffcf2536ac4476d58de to your computer and use it in GitHub Desktop.
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
| module get; | |
| enum V = 10; | |
| fn getV!(T)() T | |
| { | |
| return V; | |
| } |
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
| //T macro:import | |
| module main; | |
| static import get; | |
| enum V = 5; | |
| fn a = mixin get.getV!i32; | |
| fn b = get.getV!i32; | |
| fn main() i32 | |
| { | |
| if (a() != V) { | |
| return 1; | |
| } | |
| if (b() != get.V) { | |
| return 2; | |
| } | |
| return a() + b() - 15; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment