Hacker News
points by llm_nerd 2 days ago | 0 comments
Sort of related from yesterday - https://news.ycombinator.com/item?id=50247203

(about zig's reimplementation of the libc, and some rough edges)

[–] Numerlor 2 days ago
Zig's reimplementation of all of the standard libraries even though it's possible to use the existing ones is both baffling to me and kills usage of the implementation in my eyes.

Redoing critical parts such as crypto and compression is crazy in this day and age, hell they even have issues and merge requests open for issues that'd be headliners if found in any major language

[–] colejohnson66 2 days ago
Not just that, but on Windows, they're bypassing the actually guaranteed stable Win32 API in favor of linking directly to the lower-level components. Completely destroying any forward compatibility!

https://codeberg.org/ziglang/zig/issues/31131

It's the kind of change that makes me read Zig as not trying to be a serious language. Not that there's anything wrong with that, but the way Zig positions itself is at odds with the completely bizarre takes they do.

[–] flohofwoe 1 day ago
> Completely destroying any forward compatibility!

Microsoft breaking the ntdll.dll function interface is extremely unlikely, there's too much popular software in the wild depending on it.

[–] FacelessJim 1 day ago
If you spend some time working on cross platform code you will quickly realize that that choice is actually the right one. The NT API is actually very close in abstraction to Unix and allows for much less ad hoc code to handle windows specifics than using Win32 API (which is an abomination).

The zig windows NT implementations are very well done and I actually use them as reference when dealing with windows IO.

[–] dwattttt 2 days ago
From the link:

> > Won't this get flagged by anti-virus scanners as suspicious?

> Unfortunately, yes. We consider this a problem for the anti-virus scanners to solve.

I am suddenly less interested in relying on Zig.

[–] xydone 2 days ago
Why should you design your software around what a different piece of software could claim of your program?
[–] dwattttt 1 day ago
Because you want someone who trusts that different piece of software to use yours.

Zig's decision here means the problem is _yours_ to convince this third party to trust you.

[–] xydone 1 day ago
But the trust as a service (TaaS) platform could decide tomorrow that you are not trustworthy because, I don't know, it matched a pattern in a piece of ransomware which is actually a pattern you can produce by allocating 3 pages of memory in one call. Should you as a language now put compile time guarantees that 3 pages cannot be allocated?

This is obviously a ridiculous example, but what I'm aiming to say is, if a piece of software is matching something as untrustworthy when it's not, you shouldn't chase it down to force the little guy who's maxing good will software to fix it because the big bully thinks they are evil and deserve to get quarantined

[–] dwattttt 1 day ago
Sure. But the heuristic the TaaS world is using isn't something as absurd as "allocates 3 pages", it's "uses undocumented system APIs". We're also not arguing in the abstract that "they might make a stupid determination in the future", they're making this determination now.

I'm not a fan of the the security industry's practices, but I can't say they're making a malicious/stupid choice here.

[–] pawn1911 1 day ago
The idea/hope is perhaps that the Zig programs will be of better quality than other programs, which will make it hard for the other side (the antivirus) to justify its position in a reasonable way. And in the end the other side will be forced to change its processes.
[–] rallyroger 1 day ago
It's a shame really that Microsoft wont officially bless ntdll because it's a much more sensible API generally speaking. Like why the hell did they throw away the return value and make everyone do the insane BOOL ret = Win32Function(); if(!ret) { DWORD err=GetLastError(); } dance?
[–] neonz80 1 day ago
Not every function returnds a boolean. It is probably easier to write HANDLE file = CreateFile(...) than to send in a pointer to HANDLE. Also, this is exactly the same as what libc does with syscalls on Linux etc.
[–] not_a9 2 days ago
The next choice will be dynamically resolving syscall IDs from NTDLL? Surely that has no issues that could possibly happen.
[–] slopinthebag 2 days ago
zig users hate rust so much they found a way to make it 12,000x slower! incredible determination

(joking in case not obvious)