Top
Best
New

Posted by ksec 3 days ago

What Zig felt like, coming from Rust(besok.github.io)
276 points | 346 commentspage 3
MiroslavPokorny 2 days ago|
Im sorry running all tests is just dumb and a time waster when you want to fix just one or a few tests out of many.
bayindirh 2 days ago|
You can run any number of named tests, from what I understood?
MiroslavPokorny 2 days ago||
Of course you can, but theres a reason why people like IDES where they can point and click to select and run tests rather than typing names.
bayindirh 2 days ago||
Depends. I'm a huge fan of Eclipse (yes, that one) and use it heavily for my C++ and Python projects, yet I have no problems with hitting a couple of more keys to run some named tests when required (i.e. Go).

When I'm in my flow state, I find reaching for a pointing device is taking longer than typing something in, BTW. Keyboard driven interfaces and terminals are underrated.

MiroslavPokorny 2 days ago||
You just reiterated my point, people dont like typing long command lines with names when they could just use the smarts of an IDE.
bayindirh 1 day ago||
I don't think so. Selectively running tests is not in my top 100 reasons to use an IDE list, even.

I like IDEs for all the code insight they provide. Running a named tests by typing its name is not a nuisance by any measurable distance (for me).

MiroslavPokorny 1 day ago||
Not everyone likes the flavour of ice cream that you prefer, and thats why there are many different flavours and different cultures create their own, like say Gelato.

You might not find point and click selection of tests valuable, but the world loves GUI for the same reason, people prefer to click rather than type long commands etc. Thats why finder and windows explorer exist, because enough people would rather use that UI rather than typing at the command line.

bayindirh 19 hours ago||
And you know what? That's OK! I don't expect my list of choices match other people, or dictate theirs in any capacity.

I'm just putting forward my perspective and choices, which are also not made of granite and subject to change to the scenario, needs and possibilities in any given moment.

I strongly advocate people work the way they feel comfortable happy. Because (even if slow), it's smooth, and smooth is fast.

sgarland 3 days ago||
From TFA, on combinators vs. loops:

    items.iter().enumerate().filter(|(_, i)| cond(i)).map(|(idx, i)| Pointer::idx(i, path, idx)).collect()

    while (i < cursors.len) {
        if (actual_index < arr.items.len) { cursors[i] = .{...}; i += 1; }
        else iteration.remove(i);
    }
I’ve been slowly learning Rust, and this style is my main gripe against it, because I feel like I’m being gaslit. Its proponents praise its readability and ease of use, and just… no. It looks deranged. A simple loop is immediately obvious to anyone who’s programmed in any language. Even Python’s list comprehensions are loop-ish.
matja 3 days ago||
.len doesn't work on a list (because it might mislead you about the efficiency of the operation if it did exist), so it's better to use iterators - so then you can change the underlying type without changing your code.

But then, saying while "let Some(item) = iter.next()" everytime is tedious, so they give you .iter() - for any type that is efficiently iterable.

Nothing stopping you using a manual loop that you need to update if you change the container type.

himata4113 3 days ago||

  items.filter(|(i)| cond(i)).map(Pointer::idx).collect()
you can probably get away with this if you implement a Trait, not sure how but I know for a fact this is possible, idk why there's an enumerate there when you aren't even using it.

items is already an iteratible so you can do direct .filter on it as well

tl;dr if the code looks ugly you're probably not taking advantage of a language feature that allows it to look pretty.

sgarland 3 days ago||
This is in fact more readable, thank you.

I still don’t know that I find it more intuitive or readable than the simple loop, but it’s much less awful than before.

himata4113 3 days ago||
I am sure there's a way to filter directly on cond variable and collect isn't needed most of the time since iterators are way more useful in general (unless you want to print that data)

   items.filter(cond).map(Pointer::idx)
I know this is possible, but you would have to consult some rust wizard for this.
gslepak 3 days ago||
I'm honestly baffled why people are writing Zig or Rust and avoiding V. V (and now Bend) seems like the future to me.
a96 1 day ago||
Never heard of them. V looks neat in some ways, but there's still no 1.0, installation tells you to compile the compiler form source and it still uses and depends on a C compiler behind it. And defaults to GC. That's a ton of reasons why various people would drop it on sight. Also, inertia, of course.

Zig suffers from much of those, as does Nim. Rust OTOH appears well integrated and stable and I'm even seeing a lot of corporate use. I'd love to see V get to that level as well. But seems it's not even here in the present, let alone the future.

altairprime 3 days ago|||
Such bafflement is often a medium-strength signal of the Bystander Effect. If someone wrote and submitted to HN your own blog post comparing the Zig/Rust examples from this article to ones from V, I’d read it in its entirety knowing nothing whatsoever about V. Perhaps it will be written by you!
myko 3 days ago||
I haven't heard of those, but I've used Zig and Rust for some projects

What's the pitch?

ModernMech 2 days ago||
The V pitch was a bunch of features that seemed implausible like automatic C++ translation and near-GC ergonomics with near-manual-memory behavior, without Rust-style explicit lifetime annotations or pervasive reference counting. so basically the pitch was the holy grail of systems, which caused drama as the project was met with extreme skepticism.

That was 7 years ago and since then the project has not delivered the grail, instead settling to be more of a mashup between go and C.

Bend is completely different it was just announced last week. It doesn’t have any users and has a weird ai integration so I done see how it’s relevant as a contender in the systems space at all.

irwt 2 days ago||
Also the creator of Bend is... lets just say he doesn't stick to projects for long.
diek 3 days ago||
> One caveat worth stating up front

> Here’s the actual difference, side by side

I realize the author put a disclaimer at the bottom that they used AI for styling, but having to wade through this stuff at work all day my brain now actively rejects Claude-isms in prose.

rtpg 2 days ago|
I don't think they just used it for styling unfortunately, the entire thing felt like this.

Why can't people just write shorter bullet pointed lists of things and post that? Just post what you put into the AI!

bbg2401 3 days ago||
I don’t see the point of letting an LLM generate an article when the topic is your personal, subjective experience which only you, a human, would be able to express.
genxy 1 day ago||
https://www.pangram.com/history/3b78d6ab-4c1e-43a2-b387-366c...

61% generated by AI 12% assisted by AI

metaltyphoon 3 days ago|||
So anything that has em dashes is now considered LLM generated? What made you think this is generated?
brilee 3 days ago|||
"It's young, and it shows"

"Holds up"

"not a toy, but not a sprawling project either, and ideally.."

"And that’s the trap"

ctrl F "real" -> 6 usages

ctrl F "genuine" -> 4 usages

rep_lodsb 3 days ago|||
"Here are the cases that hit hardest, each compared against how Rust handles the same shape:"

"Rust: this exact shape can’t compile."

junon 3 days ago||||
A number of "<assertion>: <followup>" patterns too which is pretty common of at least Claude.
ifh-hn 3 days ago|||
Are these obvious signs of AI generation?
tumdum_ 3 days ago|||
Each one makes me update my estimate slightly in favour of AI. Also, pangram agrees.
layer8 3 days ago||||
In aggregate, yes.

And even if LLMs didn’t exist (or had different idiosyncrasies), the article would still be exhibiting a repeatedly weird and stilted writing style.

IshKebab 3 days ago|||
Yes.
Svip 3 days ago||||
It kind of says so at the bottom:

> Disclaimer: styling and error handling throughout this article were cleaned up with the help of AI.

The implication seems to be "light editing", but the LLM styling really comes through, so I guess that tracks.

genxy 1 day ago||
tracks like grass stains on their underwear.
abound 3 days ago||||
Not OP, but I think the leading and trailing paragraphs were mostly human-written (and nice to read), but the memory leak example cases had a very different flavor of prose and code comments that smelled very Claude-y to me
metaltyphoon 3 days ago||
After going over that section again I can see it now.
applfanboysbgon 3 days ago||||
> So anything that has em dashes is now considered LLM generated?

Is that what they said? If that's not what they said, why are you putting words in their mouth in an attempt to weaken their statement into some completely ridiculous stupid strawman that is obviously not actually what they said?

metaltyphoon 3 days ago||
That’s the first thing others point to being LLM-generated. If you see, right after the phrase you quote, there is a question as to what else OP thinks is LLM-generated. I didn’t put words into anyones mouth
12_throw_away 3 days ago|||
> [em-dashes are] the first thing others point to being LLM-generated

this isn't true and hasn't been true for a while

> I didn’t put words into anyones mouth

literally read your first sentence again, and notice the word "others"

NetMageSCW 3 days ago||
Substitute for em dashes the inaccurate AI signal du jour. Then consider not posting about whether something is AI or not.
sampullman 3 days ago||||
It's unfortunate, but to come across as genuine now I think you have to actively avoid AI-isms.

In this case it feels AI generated with human polish, or vice versa. A couple tells are "One caveat worth stating up front..." and of course, "...the shape of the language itself...".

12_throw_away 3 days ago||
> It's unfortunate, but to come across as genuine now I think you have to actively avoid AI-isms.

I actually think this might be a good thing? I'm way more aware of cliches and filler in my writing these days, and it almost always reads better when I just remove them and plainly say the thing.

greenhat76 3 days ago|||
"And honestly"
ivanjermakov 3 days ago|||
"Having a blog is cool these days"
aitoolcrux 2 days ago||
The biggest shift isn't the language itself, it's the mental model of ownership. Rust trains you to think "who owns this, who frees this, what's the borrow state at this line?" every time you touch memory. Zig trains you to think "this is my buffer, I'm responsible for it, no surprises" — but the compiler doesn't stop you from getting it wrong.

What I found in practice: the borrow checker friction is real, but it also silently eliminates a whole class of concurrency bugs that Zig's safety checks can't catch. When you reach for Zig on a project where multiple threads touch the same arena, you end up hand-rolling the invariants Rust enforces by default. The question is whether the dev-time friction is worth the invariant guarantee.

For services where a memory safety bug = outage + data loss, I'll take Rust's friction every time. For CLI tools and one-off scripts where the worst case is a crash, Zig's lack of ceremony wins.

myko 3 days ago||
> One caveat worth stating up front

It would be nice if people would note that their posts are AI generated, and put that in the title here to make it easier to ignore

Hugsbox 3 days ago||
I'm not exactly sure what you mean, that seems like a pretty phrase to me, is it considered an LLMism now? Kinda feels like the same thing with the em-dashes; I can't use em anymore because people will then assume I'm an LLM, even though just a few years ago it was a perfectly normal thing to do.

It's entirely possible I'm just getting worse and worse at picking out LLM writing these days too, who knows.

comex 3 days ago||
It’s a very common tic of recent Claude models specifically. Don’t worry - for better or worse, the labs are trying to train away AI writing smells (for example, Anthropic talked about Fable 5.1 having more natural writing), so this particular tic will probably become outdated as an AI indicator relatively soon, as em dashes already have. And then people will forget about it.
833dong 3 days ago||
[flagged]
theturtle 3 days ago||
[dead]
hn_submit 3 days ago|
There will never be a true successor to C since C is "high level assembly." The lack of pointer checking, unsafe casts and non-existent bounds checking aren't an oversight but by design! Assembly doesn't have them so neither does C! There's no reason to whine about it.

The real problem is that people are using C for the wrong reasons. C is for the development of operating systems and low-level code, not applications.

Zig is more modern but anything that does even one iota more of hand-holding or has anything that looks like a guardrail fails the test.

If you want to write applications use Pascal, Java, C#, Swift or Go.

slopinthebag 3 days ago||
i dunno, people are using rust effectively to build applications too. and apple has started using swift in the kernal.

i do agree that applications are probably best built in fast garbage collected language. but it also seems like go, java, C#, etc have other downsides that push people towards things like zig or rust even for apps. it also depends on what you mean by "apps". is a server an app? what about an actual native cross-platform desktop application? does go, c#, or java have a good paradigm for that? what if you want to use an oss language not tied to a big tech company? you start running out of suitable languages pretty dang fast.

you could name any application type and i could probably give you reasons why you might want to build it in a "systems" language instead of a high level one.

davemp 3 days ago|||
Have you written anything low level in Zig? If anything, Zig is lower level than C.

A lot of the “high level assembly” parts of C are actually compiler extensions and not from the C spec.

libc is even worse.

hn_submit 1 day ago||
C wasn't meant to fully replace low-level languages like Assembly. Context switching still isn't possible in C (nor in Zig).

And most C library calls are actually Unix system calls. Malloc() is an operating system call and not a library call. Yes, they made it a library call later on to facilitate usage in other operating systems but it was originally an integral part of the Unix OS.

monocasa 3 days ago|||
Except Rust is actively being used in kernel space and low level embedded systems as well.
hn_submit 3 days ago||
It's useful, but systems programming languages shouldn't be used to create applications in the first place.

We're trying to solve a problem that shouldn't be solved. We're continuing and even confirming the usage of systems programming languages for application development.

boomlinde 3 days ago|||
What are the requirements and design constraints of an application? Please give a general answer that applies to all applications.
hn_submit 2 days ago||
Anything that's not an operating system kernel.
boomlinde 1 day ago||
You didn't answer nor apparently read my question. You can just answer it in whatever terms you consider some piece of software to be an application when you say "systems programming languages shouldn't be used to create applications in the first place."
everforward 3 days ago||||
I don’t think this delineation is that clear, unless by “application” you mean the app tier of a 3 tier app.

Postgres and Nginx make sense in system programming languages; they’re extremely performance sensitive and that granular level of control offers them features. Interpreters are sort of the same, they interact with the OS a ton, it makes sense to work in the same language as the OS.

I do generally agree for the app tier of a web app. I wouldn’t build a CMS in Rust, but I also wouldn’t build a reverse proxy in Python.

hn_submit 3 days ago||
Writing an operating system kernel in C is valid usage since there's a great deal of thought going into it and it almost never changes.

EVERYTHING ELSE is invalid usage no matter how performance critical people claim their application is. These are just excuses for people to use a grossly unsafe language to get that last 2% of performance whilst costing the world trillions in lost productivity and security breaches.

RossBencina 3 days ago||
An operating system kernel is the last place you want an unsafe language, if you can help it.
monocasa 3 days ago||||
Rust is also a great language for app code. I reach for it now in places I used to use python.
tcfhgj 3 days ago|||
why shouldn't they? humanity consumes more resources than is sustainable, and systems languages can help to reduce resource consumption.
PaulDavisThe1st 3 days ago||
Is a digital audio workstation or a "AAA" game, with their timing constraints, unbounded computational loads and general demanding performance requirements closer to "an application" or "operating systems and low level code" ?
hn_submit 2 days ago||
An application since it's not an operating system kernel.
PaulDavisThe1st 2 days ago||
so you're suggesting that developers of these types of applications are making a mistake by using C++ ?
hn_submit 11 hours ago||
New development in C++ would be a dire mistake, but you can't expect everyone to switchover on a moment's notice.

C and C++ are a liability for many reasons since memory corruption is notoriously hard to detect, localize and fix. And multi-threading is even harder, almost a dark science to get right.

For those reasons alone Rust is a no-brainer.