Last active 1 year, 4 months ago


Last active 1 year, 7 months ago


Last active 4 years ago
View more

Recent activity

Re: [_]struct within [_]struct (was comptime map) 8 months ago

From martin to ~andrewrk/ziglang

Hey Peter!

I've followed your thread for the past few weeks, and while I certainly can appreciate your concrete questions, I'm not sure I understand what your overall goal is. (i.e., maybe we've got an XY-problem at hand, where you ask for something that's awkward to do in Zig but the problem you're having could be solved by something different, which would be easy to do in Zig)  It looks like you have a bunch of states that each have a slice of other states that they'd want to invoke somehow, from an event or something. Could you be a little more descriptive?

I hope I can offer some insight on tuples though, because it's actually really simple; a tuple is just an anonymous struct, in which the struct fields have the names `0`, `1`, ... 

For instance,

const std = @import("std");
​pub fn main() !void {
    const foo = .{ 10, -2, 99 };
    std.debug.print("{}\n", .{ foo.@"1" });