Live data from Hacker News

Zig's new bitCast semantics and LLVM back end improvements

ziglang.org

151–159 of 159 posts

Re: Zig's new bitCast semantics and LLVM back end improvements

#151
post #20

Earlier quoted context omitted.

Old habits :) If I had to steel-man the idea, I'm pretty sure the integer-based solution has better codegen with many kinds of sparse, comptime-known masks. I think you're right though, StaticBitSet looks better.

For your specific case, even a simple `[9][9]u16` might perform better (where you make use of nine bits in each u16). For each entry, the nine mask bits would be in the same bit positions, so the compiler won't have to do a bunch of shifts to extract/align the bits. CPUs love consistency. I doubt it's worth the additional codegen complexity to save 70 bytes in your data model.

My initial implementation used [9][9]u9 (which desugars to [9][9]u16 with some zero bits) and was a fair bit slower. If I had to guess, it's because the shift/extract/align you're describing isn't actually a part of the core solving algorithm, and when you have box constraints, knights-move constraints, etc, you're usually not doing anything which fits in a single u16.

Re: Zig's new bitCast semantics and LLVM back end improvements

#152
post #143

Earlier quoted context omitted.

Wait till you hear how many programming languages there are

Different programming languages are very obviously not the same thing - different cp command implementations are similar conceptually to having different linker implementations that all do the same thing. But you knew that so not sure if there was a point you were trying to make there.

> Different programming languages are very obviously not the same thing

It isn't obvious to me at all. The difference between Java, C# and Go is about as important as the difference between Makita and Bosch for power tools. Yes, some people swear by one or the other, but by the end of the day it really doesn't matter

Re: Zig's new bitCast semantics and LLVM back end improvements

#153
post #73

Earlier quoted context omitted.

i think it's perfect: AI allows you to go incredibly deep (you have unlimited access to context to make incredibly impactful surgical changes), or you can go incredibly broad (you have unlimited access to context to tie a mind numbing amount of components together). what shakes out is the middle layer: "infra" between "algorithms" and "product". though, to be fair, the middle layer itself is composed of this same wor…

And why do you mention AI here at all? These statements are ridiculous, world didn't start last year.

because i was responding to a comment about it.

Re: Zig's new bitCast semantics and LLVM back end improvements

#154

OT: I'm always surprised at how popular Zig discussions get here, or Youtube and other medias. Don't get me wrong, I love Zig and I think it's a great C replacement, but I'm very confused on why C3 or Odin rarely get any attention at all, despite being in the same C-replacement crowd. But still surprised at what Zig does better than these other projects? Is Andrew much better at marketing/promoting the language? He's…

Zig was the first to appear on my radar. I believe I saw Andrew's first (?) talk called the "The road to Zig 1.0" where he communicated his vision very clearly in a way that must have sounded like the promise of the holy land for C programmers who were stuck in C hellscape. Maybe it was even an earlier video where he talked after a rust talk but it was essentially the same message.

Maybe the best marketing is to establish your vision and stick to it over the years ?

In any case c3 didn't exist, I had never stumbled on a talk of Odin's creator and its syntax seemed more foreign (I only knew C back then) so I started rooting for zig. Even though it's not 1.0 yet, zig seems more ambitious (incremental compilation ! comptime ! translate-c ! logical bitcasting !) and committed to the vision of C companion/replacement. That for me is enough to still be hyped ten years after.

Re: Zig's new bitCast semantics and LLVM back end improvements

#155
post #4

Interesting read, even as someone who isn't using Zig. I wonder, these arbitrary-width integers... Is it actually even really worth it? My intuition is to prefer manually packing/unpacking things instead (in any language, even C that has bit width for struct fields), because it gives me a better mental picture of the code that is actually generated. Particularly for something like an signed odd-bit integer - what kin…

If you use LLVM at least, they expand to a lot of code which is repeated on every operation. There’s a point where the inline code will just blow the instruction cache and just create unacceptable binary bloat.

Re: Zig's new bitCast semantics and LLVM back end improvements

#156

Earlier quoted context omitted.

Odin has SDL built into the language (shipped as a vendored library).

That's not what I mean... There is a mountain of code written in C that you can simply include in Zig without a wrapper dependency and without having to create the wrapper yourself.

The Zig C import is going away, moving into a tool invoked from build.zig, so this might not be an ideal thing to point to.

C3 just has everything C compatible so not just calling into C but also C calling to C3 is just completely normal with no special compatibility types/functions, unlike Zig.

So which one has the most compelling feature kind of boils down to what one focuses on.

You can find Odin users that praise Odin for finding their sweet spot. Similarly for C3 users, just like Zig users.

And in each of those, they will say that the others didn’t quite match what they wanted (not in all cases though: the relatively high visibility of Zig means a lot of its users is unaware of the languages with less visibility, and just pick it by default)

Re: Zig's new bitCast semantics and LLVM back end improvements

#157
post #94

> Quite long devlog coming up, apologies—I got a little carried away with this one! mlugg, please don't apologize for creating something I actually want to read. I'm drowning in low effort garbage, the in depth technical explanation is a refreshing breath of fresh air. Might as well apologize for creating a language without a garbage collector, sure most people are unwilling to think, but some of us like nice things…

Why I've moved more to a couple of language/software dev discords and away from Hacker News. Way too much uninteresting AI nonsense on here for a while now.

That and the continual pushing of Zig and Rust to ridiculous levels, like HN had investments in them or were getting payouts, and as if few to no other programming languages exist.

Re: Zig's new bitCast semantics and LLVM back end improvements

#158

OT: I'm always surprised at how popular Zig discussions get here, or Youtube and other medias. Don't get me wrong, I love Zig and I think it's a great C replacement, but I'm very confused on why C3 or Odin rarely get any attention at all, despite being in the same C-replacement crowd. But still surprised at what Zig does better than these other projects? Is Andrew much better at marketing/promoting the language? He's…

> I'm very confused on why C3 or Odin rarely get any attention at all, despite being in the same C-replacement crowd

Your observation is valid, and many would say because something smells very fishy with what HN is doing. Zig is pushed at extremely nonsensical levels on HN, despite there being very worthy and interesting language contenders in the category: C3[1], Odin[2], Vlang[3], Dlang[4], Zen C[5], etc...

We rarely get to see news about these other languages, but instead are constantly saturated with and hit over the head with news about Zig (despite all kinds of issues and being beta). And as if people don't have interests in or don't want to see anything about other young or newer languages in the category.

[1]: https://github.com/c3lang/c3c

[2]: https://github.com/odin-lang/odin

[3]: https://freedium-mirror.cfd/https://levelup.gitconnected.com...

(The V Language: The Best Parts of Go, Rust, and Python — All in One)

[4]: https://freedium-mirror.cfd/https://levelup.gitconnected.com...

(The D Language: A Better C/C++ Alternative Only a Few Programmers Know)

[5]: https://github.com/zenc-lang/zenc

Re: Zig's new bitCast semantics and LLVM back end improvements

#159

OT: I'm always surprised at how popular Zig discussions get here, or Youtube and other medias. Don't get me wrong, I love Zig and I think it's a great C replacement, but I'm very confused on why C3 or Odin rarely get any attention at all, despite being in the same C-replacement crowd. But still surprised at what Zig does better than these other projects? Is Andrew much better at marketing/promoting the language? He's…

I think Andrew is a big part of it, and the people he surrounded himself with are the other part. What kind of pre-1.0 language hosts conventions? Crazy that they manage to do that. Andrew's vision has always been clear and inspiring to me. I think this got Zig its initial following, and they have capitalized extremely well on it to grow as a community.

But, there is something uncouth going on at HN too. Attempts to submit articles for competing programming languages to HN often get removed. Doesn't matter the source either. Could be MSN, Medium, YouTube, whatever...

Those other competing languages get censored or disappear, however, whatever kind of Zig article that is submitted appears to get heavily pushed and promoted on HN. No matter how much blatant marketing propaganda that it is or that it's coming directly from the language's site or team (as oppose to a reputable 3rd party source).

Post reply on HN