News for hackers. Stuff that matters.
Re:Zig: a system language which prioritizes optimality, safe... by tom_mellior on Monday August 29, 2016 @04:42AM (#12380758)
One more syntax issue:

http://andrewkelley.me/post/intro-to-zig.html shows the

    const number = parse_u64(str, 10) %% |err| return err;
pattern and then goes on to say that you can avoid repeating "%% |err| return err" all the time by writing

    const number = %return parse_u64(str, 10);
instead. I don't think that's particularly nice; it looks too much like "return the result of the call" when that's only what happens in the error case. I would have expected something more like this:

    const number = parse_u64(str, 10) %% return error;
where the compiler would turn "return error" into "|_some_var| return _some_var".
Re:Zig: a system language which prioritizes optimality, safe... by pmontra on Monday August 29, 2016 @06:17AM (#12380995)
Agreed, %return is confusing and sends the reader down a wrong path.

Your last example could work if error is the default name for the error variable, which makes sense.

Re:Zig: a system language which prioritizes optimality, safe... by codygman on Tuesday August 30, 2016 @03:15AM (#12388106)