4 ms·
I'll leave this here, try guessing what this prints: const std = @import("std"); const myType = struct { const info = @typeInfo(myType);
by SkiFire13 2y ago
I'll leave this here, try guessing what this prints:
const std = @import("std");
const myType = struct {
const info = @typeInfo(myType);
const before = info.Struct.decls.len;
pub usingnamespace (if (before == 0) struct { pub fn baz() void {} } else struct {});
const after1 = info.Struct.decls.len;
const after2 = @typeInfo(myType).Struct.decls.len;
};
pub fn main() void {
std.debug.print("Hello, {} {} {}!\n", .{ myType.before, myType.after1, myType.after2 });
}
- throwawaymaths 2y agowell i suppose this is a good part of the reason why usingnamespace is likely to go the way of the dodo, though if i had to guess: hello: 4, 5, 5