Live data from Hacker News

Zig by Example

github.com

31–40 of 109 posts

Re: Zig by Example

#31
post #21

Is Zig just a trend, or will it become a solidly established language? After all, learning something is an investment of time. With Zig, it doesn't seem to have the same kind of industry pressure as Rust. There's talk in open source circles about AI-related issues, and on Hacker News people say good things about Zig. The allocator concept looks great. But there's also a possibility that it won't become mainstream, li…

What's the difference between a trend and a solid language? I bet many (I mean like millions) people still think Rust is a trend.

> To go deeper, I think I need to dig into a systems language

Most of such code is still written in C.

But honestly, if you just need to squeeze a little bit more performance, you should check the non-GC part of C# first (ArrayPool, Span, stackalloc).

Re: Zig by Example

#32
post #21

Is Zig just a trend, or will it become a solidly established language? After all, learning something is an investment of time. With Zig, it doesn't seem to have the same kind of industry pressure as Rust. There's talk in open source circles about AI-related issues, and on Hacker News people say good things about Zig. The allocator concept looks great. But there's also a possibility that it won't become mainstream, li…

IMO, there isn't much space left to fill that Rust couldn't already fill.

Simplicity is one thing Zig excels at (at least from my early observations).

Re: Zig by Example

#33

Looking for a resource (MCP, CLI, Skill, ...) that would improve Zig support in LLMs. Currently, doing something with Zig as a target language would spend many more tokens and produce subpar results.

Best bet is tight integration with a language server and the zig docs as MD locally. You may also pull in the zig source code as canonical reference for best practices.

From there you can derive a set of tools and references that you can build skills on.

Any LLM can scratch together an MCP server, its basically FastAPI + functionality. Your goal, then, is to identify the subset of tools and data required to get 'good' output.

If you want to test your MCP server implementation, grab the source of several popular zig projects, rewind their git history, and have your LLM of choice attempt to address PRs for issues on those repos. Compare LLM solutions with the repo solutions, grade on token spend, LOC produced, variance from Zig best practices, and so on.

Re: Zig by Example

#34
Encapsulating arguments inside .{} seems superfluous and noisy.

I'm sure this can be rationalized in some way, to either simplify parsing or solve some rare ambiguity, but I just don't see it.

I know this is a minor thing and can be considered as nitpicky, and I expect some friction with syntax when learning a new language, but I just can't stand things I see as gratuitous. Same with the forced use of _ = foo(.{}); to avoid compiling errors...

Re: Zig by Example

#35

Earlier quoted context omitted.

If you worked through this and learnt to use zig, your token usage would be even lower!

Don't be ridiculous. Learning? That's for the dinosaurs. Just throw an llm at the problem!

Both is good. I do both, and to get reasonable output from an LLM I _have_ to do both.

Re: Zig by Example

#36
post #21

Is Zig just a trend, or will it become a solidly established language? After all, learning something is an investment of time. With Zig, it doesn't seem to have the same kind of industry pressure as Rust. There's talk in open source circles about AI-related issues, and on Hacker News people say good things about Zig. The allocator concept looks great. But there's also a possibility that it won't become mainstream, li…

I'm suspicious that the user base is people who like to program using pointers in business logic. So, the subset of current C programmers who are willing to switch.

With this in mind: Does anyone here program in Zig, or know someone who does who is not a current C (or C++) programmer?

Re: Zig by Example

#37
post #21

Is Zig just a trend, or will it become a solidly established language? After all, learning something is an investment of time. With Zig, it doesn't seem to have the same kind of industry pressure as Rust. There's talk in open source circles about AI-related issues, and on Hacker News people say good things about Zig. The allocator concept looks great. But there's also a possibility that it won't become mainstream, li…

Zig is not only a language. Its whole toolchain and takes freestanding as a target seriously.

Re: Zig by Example

#38
post #21

Is Zig just a trend, or will it become a solidly established language? After all, learning something is an investment of time. With Zig, it doesn't seem to have the same kind of industry pressure as Rust. There's talk in open source circles about AI-related issues, and on Hacker News people say good things about Zig. The allocator concept looks great. But there's also a possibility that it won't become mainstream, li…

I'm suspicious that the user base is people who like to program using pointers in business logic. So, the subset of current C programmers who are willing to switch. With this in mind: Does anyone here program in Zig, or know someone who does who is not a current C (or C++) programmer?

I program in zig. I am not a current C/C++ programmer (last time I touched C++ was 2003; I can read C ~just fine... write, uh, I just hate make, okay?).

Most recently I have used zig for:

Linux USB driver for a proprietary industrial digital camera that claude hacked the protocol for (I usbpcap'ped it), bound into an embedded Elixir-Nerves biology workstation. Same workstation has a libtoupcap digital camera for a microscope camera also mounted (here I use zig for the dlload boundary with elixir). The proprietary system I am running it on ironically won't work with windows anymore because the proprietary software it shipped with chokes when there are two cameras attached.

I ship zigler, the embed-zig-in-elixir library. I keep finding more and more uses for it!

Re: Zig by Example

#39

Earlier quoted context omitted.

IMO, there isn't much space left to fill that Rust couldn't already fill.

Simplicity is one thing Zig excels at (at least from my early observations).

Yup. Rust tries to make it hard to do systems programming poorly. Zig tries to make it easy to do systems programming well. Rust pushes you into certain (good) practices. Zig makes it exceptionally easy to understand what's happening, making good practices the obvious choice.

Re: Zig by Example

#40
post #21

Is Zig just a trend, or will it become a solidly established language? After all, learning something is an investment of time. With Zig, it doesn't seem to have the same kind of industry pressure as Rust. There's talk in open source circles about AI-related issues, and on Hacker News people say good things about Zig. The allocator concept looks great. But there's also a possibility that it won't become mainstream, li…

I'm suspicious that the user base is people who like to program using pointers in business logic. So, the subset of current C programmers who are willing to switch. With this in mind: Does anyone here program in Zig, or know someone who does who is not a current C (or C++) programmer?

Also people who wants to get into lower level languages but is scared of C's footguns and C++/Rust language size: me.
Post reply on HN