• 2 Posts
  • 8 Comments
Joined 1 year ago
cake
Cake day: September 1st, 2023

help-circle
  • I have never written a line of code in Zig, but I can read it and derive a pretty good idea of what the syntax means without a lot of effort. The same cannot be said for Rust.

    That’s you dawg. You probably have a different background, because I can follow zig code, but have no idea what a bunch of stuff means.

    See samples

    pub fn enqueue(this: *This, value: Child) !void {
                const node = try this.gpa.create(Node);
                node.* = .{ .data = value, .next = null };
                if (this.end) |end| end.next = node //
                else this.start = node;
                this.end = node;
            }
    

    pub fn enqueue(this: *This, value: Child) !void { , !void? It’s important to return void? Watch out void is being returned? Does that mean that you can write !Child ? And what would that even mean?

    const node = try this.gpa.create(Node); what does try mean there? There’s no catch, no except. Does that mean it just kills the stack and throws the exception until it reaches a catch/except? If not, why put a try there? Is that an indication that it it can throw?

    node.* = .{ .data = value, .next = null }; excuse me what? Replace the contents of the node object with a new dict/map that has the keys .data and .next?

    if (this.end) |end| end.next = node // what’s the lambda for? And what’s the // for ? A forgotten comment or an operator? If it’s to escape newline, why isn’t it a backslash like in other languages?

    start: ?*Node. Question pointer? A nullable pointer? But aren’t all pointers nullable? Or does zig make a distinction between zero pointers and nullable pointers?

    pub fn dequeue(this: *This) ?Child {
                const start = this.start orelse return null;
                defer this.gpa.destroy(start);
    

    this.start orelse return null is this a check for null or a check for 0 or both?

    However when I read rust the first time, I had quite a good idea of what was going on. Pattern matching and move were new, but traits were quite understandable coming from Java with interfaces. So yeah, mileage varies wildly and just because you can read Zig, doesn’t mean the next person can.


    Regardless, it’s not like either of us have any pull in the kernel (and probably never will). I fear for the day we let AI start writing kernel code…

    Anti Commercial-AI license










  • Fuck dude, we need an alternative to the Linux Foundation that actually focuses on Linux itself, not every single project that somehow runs on Linux. The linux kernel is a pain to join as a newbie, it’s underfunded (2% of all the Linux Foundation’s funding goes to the Linux kernel), the development cycle and tooling is outdated, the major language © is a security risk, the maintainers are turning old and gray which brings with it the typical resistance against change, and so many other things.

    I don’t know if a fork is needed with a new org surrounding it that focuses 100% on the kernel, or if something else has to happen, but the Linux foundation wasting money on shit like AI and endorsing Chromium sounds an awful lot like Mozilla. Mozilla lost its way a long time ago and the Linux Foundation might be going the same way too.

    Anti Commercial-AI license