News for hackers. Stuff that matters.
Re:Crabtime: Zig's Comptime in Rust by SkiFire13 on Saturday March 22, 2025 @12:56PM (#43447048)
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 });
    }
Re:Crabtime: Zig's Comptime in Rust by throwawaymaths on Saturday March 22, 2025 @02:29PM (#43447588)
well 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