Advertisement
Guest User

Untitled

a guest
May 14th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.51 KB | None | 0 0
  1. // main.zig:
  2. const std = @import("std");
  3. const builtin = @import("builtin");
  4. const typeinfo = builtin.TypeInfo;
  5. const typeid = builtin.TypeId;
  6.  
  7. pub fn main() anyerror!void {
  8.     const info = @typeInfo(@import("namespace.zig"));
  9.  
  10.     switch (info) {
  11.         typeid.Struct => |s| {
  12.             inline for(s.defs) |def| {
  13.                 std.debug.warn("{}\n", def.name);
  14.             }
  15.         },
  16.         else => unreachable,
  17.     }
  18. }
  19.  
  20. // namespace.zig
  21. const hello = struct {};
  22. var world: i32 = undefined
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement