Skip to content

Instantly share code, notes, and snippets.

@bhelyer
Created July 2, 2018 08:40
Show Gist options
  • Select an option

  • Save bhelyer/0e390e27a71afffcf2536ac4476d58de to your computer and use it in GitHub Desktop.

Select an option

Save bhelyer/0e390e27a71afffcf2536ac4476d58de to your computer and use it in GitHub Desktop.
module get;
enum V = 10;
fn getV!(T)() T
{
return V;
}
//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