Comment on Zig’s Io.Threaded is neatparentComments−simjnd20dBut the capture is conditional so it makes sense.if (evaluation) result = evaluationif (evaluation) |result|Although assignments as expressions in C are convenient, I don't think they make a ton of sense and find Zig's capture easier to read (easier to immediately see what's being evaluated)−ulbu20dif |result| (evaluation)−simjnd20dI think you could argue for it both ways. Then you could claim ternaries are inconsistent too, shouldn't it be:resultA : resultB ? (evaluation)if we always put result first?I think the most important piece of if statements and ternaries is the condition being evaluated and it's worth putting that first?−ulbu20dbut zig has no ternaries, so it does not apply to a discussion about zig’s syntax.and ternary is a branch with no variable introduction, so it doesn’t apply again.(it’s basically a weak switch expression, and the value moves leftwards towards its invocation.)
Comments
But the capture is conditional so it makes sense.
if (evaluation) result = evaluation
if (evaluation) |result|
Although assignments as expressions in C are convenient, I don't think they make a ton of sense and find Zig's capture easier to read (easier to immediately see what's being evaluated)
if |result| (evaluation)
I think you could argue for it both ways. Then you could claim ternaries are inconsistent too, shouldn't it be:
resultA : resultB ? (evaluation)
if we always put result first?
I think the most important piece of if statements and ternaries is the condition being evaluated and it's worth putting that first?
but zig has no ternaries, so it does not apply to a discussion about zig’s syntax.
and ternary is a branch with no variable introduction, so it doesn’t apply again.
(it’s basically a weak switch expression, and the value moves leftwards towards its invocation.)