Hacker News new | ask | show | jobs
by jadodev 1121 days ago
Have any examples of syntax you find tasteless? Things in Zig that feel ergonomic to me: comptime params > separate generic args; ptr.* > *ptr; optional pointers > possibly null normal pointers; separate syntax for slices, arrays, & pointers > 1 syntax for ptr & arrays.
1 comments

  var t: ?i32 = null;

  if (t) {

      t +=1;

  }

This for example doesn't work, you have to capture, many little things like that that stacks up and ends up creating a non-ergonomic syntax

No for loop, so you have to do multilines things like, and now you meet a new : construct, this pseudo for loop now looks confusing to look at

  var i: i32 = 0;

  while (i < 42) : (i+=1) {

  }

Then constant casting between integers, and also floats.. also no operator overload for the math types etc..

Also not a fan of the pointer difference between [] * [:0], too much different nitpicking that makes iterating slow and painful, I understand the benefits, but the way it's done is not enjoyable, at least to me

That's just whats on the top of my head, it's been a while I haven't wrote Zig code so I may be remembering wrong