Skip to content

Instantly share code, notes, and snippets.

@koljakube
Created June 14, 2020 13:00
Show Gist options
  • Save koljakube/282ba3362edad66fa160d65e67f081cf to your computer and use it in GitHub Desktop.
Save koljakube/282ba3362edad66fa160d65e67f081cf to your computer and use it in GitHub Desktop.
fn Awesome(comptime b: bool) type {
return struct {
usingnamespace if (b)
struct {
pub fn foo() void {
std.debug.warn("wowser.\n", .{});
}
}
// else struct {
// }
;
};
}
pub fn main() void {
const a = Awesome(true);
a.foo();
// const b = Awesome(false);
// b.foo();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment