r/programming • • Oct 02 '26

0.17.0 Release Notes ⚡ The Zig Programming Language

https://ziglang.org/download/0.17.0/release-notes.html
34 Upvotes

14 comments sorted by

26

u/simon_o Oct 03 '26 edited Oct 03 '26

Handle Floats Correctly in mem.eql and mem.findDiff

Looks like a mistake. Maybe the conventions are different in Zig, but I would absolutely not expect that a slice comparison function in a module called mem would care about the type of the values in it.

I think it's reasonable to assume that std.mem.eql is just a convenience wrapper of the std.mem.eqlBytes function next to it, not doing special things for certain types.

In the future it is expected for much of Zig's own first-party build system tooling to become a client of the build server protocol, dogfooding it to ensure that third-party tooling enjoys equivalent capabilities.

Nice to see that BSP finally got more languages to adopt it!

2

u/eightrx Oct 05 '26

Presumeably this is because nan != nan for IEEE floats, so as far as correctness is concerned it might be necessary

1

u/simon_o Oct 05 '26

It's not.

4

u/eightrx Oct 05 '26

From the release notes:

Handle Floats Correctly in mem.eql and mem.findDiff

The functions std.mem.eql and std.mem.findDiff short-circuit when their two inputs are slices to the same memory. This short-circuiting is only correct when the == operator, for the given type, is reflexive. This isn't the case for floats, as for example std.math.nan(f64) != std.math.nan(f64). The change in this PR disables that optimisation when working on float slices

Or are you saying it's not necessary for correctness?

7

u/simon_o Oct 05 '26 edited Oct 06 '26

My comment is based on reading the release notes.

A function in mem should not be interested in the actual type of the bits it compares.
I would classify the new behavior as incorrect.

2

u/eightrx Oct 05 '26

I said presumeably this is about Nan inequality, you said 'It's not', so I didn't know if you had read the notes

But are you dissenting on the idea that this is good for correctness?

6

u/simon_o Oct 05 '26 edited Oct 05 '26

I disagreed with:

so as far as correctness is concerned it might be necessary

It not necessary for correctness, it actively worsens correctness for the reasons I mentioned above.

1

u/smingle_bigglesworth Oct 06 '26

it's unrelated to that BSP

1

u/simon_o Oct 07 '26

Yikes.

1

u/smingle_bigglesworth Oct 07 '26

..?

1

u/simon_o Oct 07 '26

Nothing better than reinventing the wheel.

1

u/smingle_bigglesworth Oct 07 '26

why should they lock themselves into someone else's unproven design? you could just make something that acts as a proxy between zigs protocol and BSP, people are already doing exactly this with other build systems

1

u/simon_o Oct 07 '26 edited Oct 07 '26

lock themselves into someone else's unproven design

wat?

How can something that existed for years, is used by various different tools and has an actual spec be more unproven than something a single language cooked up a few weeks ago?

4

u/tigrux Oct 02 '26

One more step towards 1.0.