News for hackers. Stuff that matters.
Re:Zig in 30 Minutes by jeltz on Monday January 04, 2021 @01:35AM (#25628421)
To me the scope leak was annoying because how Zig does not allow shadowing, so I have to write:

  var it = a.getSomeIterable();
  while (it.next()) |item| {
      ...
  }

  var it2 = b.getSomeIterable();
  while (it2.next()) |item| {
      ...
  }
Re:Zig in 30 Minutes by Leherenn on Monday January 04, 2021 @04:33AM (#25629216)
You can do:

  {
    var it = a.getSomeIterable();
    while (it.next()) |item| {
        ...
    }
  }
  {
    var it = b.getSomeIterable();
    while (it.next()) |item| {
        ...
    }
  }