Live data from Hacker News

Zig: Build System Reworked

ziglang.org

241–250 of 263 posts

Re: Zig: Build System Reworked

#241
post #234

Earlier quoted context omitted.

So your ice turns 'let unused = func();' into 'let _ = func();' automatically? Okay but then do I later have to grep for 'let _' to find all these unused variables and delete them? This is silly and a has consequence of zig not having any system for warnings

Why not ignore unused variables in debug and warn in release mode?

Warning everywhere makes sense. BMG zig doesn't have warnings at all. Just errors

Re: Zig: Build System Reworked

#242
post #207

Earlier quoted context omitted.

C# is close to achieving that goal.

People always laugh when I mention C# in this regard. It has so many things, like pointer, you can define that memory alignment works like in C, SIMD, AoT compilation, Span . I think you can do pretty much C like programming in C#.

We had several of such languages in the 2000's. C# is basically becoming what Modula-3 already offered.

Re: Zig: Build System Reworked

#243
post #90

Earlier quoted context omitted.

My guess is that one of these (Andrew) is measuring syscalls and the other is measuring vtable indirections.

A vtable indirection is essentially free when you're going to perform a syscall. What matters is that the buffer is above the vtable (which is already the case for the current implementation) so that you don't pay for the indirection when hitting the buffer.

And if you write to a bytes buffer?

Re: Zig: Build System Reworked

#244

There is an idea I've been kicking around for a long time, which I'll just call dual programming. The idea is to develop a stack that consists of just two programming languages, 1 higher level language, and one lower level language. You are supposed to do as much programming as you can in the high level language, and only drop into the low level language as needed. The problem is that unless you already know a low le…

I believe that is how SpaCy is developed. Models are implemented in Cython and user facing API in Python.

Re: Zig: Build System Reworked

#245
post #194

Earlier quoted context omitted.

> It doesnt let you have unused variables Ugh. This is something I hate about Go. I would be happy to have unused variables generate warnings, but as errors, they turn the toolchain into an adversary. It's common for me to temporarily comment out a variable's use when developing new code, as I experiment with ideas. It's even more common when working in unfamiliar code, such as tracking down a bug or incrementally ad…

> Ugh. This is something I hate about Go Yeah it drives me insane. Working in any ide's golang lsp/plugin that tries to solve this for you every time you hit save also drives me insane. Feel like something is lost experiencing/learning/becoming masterful at a language when these types of decisions get automated while you're hand crafting. I actually really valued my exploration into C where if i did that, id get a fa…

Well its also just idiotic in terms of how some huge number of people write code.

I know I'll need so-and-so import, so i write it at the top of the file before i even start, I press ctrl-s and it dissapears... I honestly laughed out loud the first time i used gopls.

Re: Zig: Build System Reworked

#246
post #185

Earlier quoted context omitted.

> But nothing gets in your face how to use the programming language "correctly". It doesnt let you have unused variables and theres no multiline comment support. These are fairly significant productivity issues for me

> It doesnt let you have unused variables Andrew Kelly on that: https://www.youtube.com/watch?v=iqddnwKF8HQ&t=2927s Looks like you might be able to get rid of the error easily with annotations.

as a fan of him this rationale did not make a shred of sense

"Both parties can have their preference" - this was already true of C where you can just turn enable unused variable warnings or turn them into hard errors, this has nothing to do with the decision.

I also don't want my lsp randomly rewriting my code (???)

Re: Zig: Build System Reworked

#247
post #8

After having used Zig for a couple of months now I am convinced it is a fantastic tool language. You just pick it up to hack some idea together freely. Every time I hit a wall, I find the creators have thought of it already and offers comfort. But nothing gets in your face how to use the programming language "correctly". For me it is now the go-to "tinker in my garage" language.

> But nothing gets in your face how to use the programming language "correctly". It doesnt let you have unused variables and theres no multiline comment support. These are fairly significant productivity issues for me

You can discard a variable like so:

_ = variable_to_discard

I am sorta unsure why Zig doesn't have multiline comments, but its also not at version 1 yet, so that will likely come, along with better IDE support.

Re: Zig: Build System Reworked

#249

Would someone tell a rust user why they should and should not try zig?

> and should not try zig? Because it isn't memory safe. I honestly think it's beyond the point of "irresponsible" and well into "negligence" that we're still developing unsafe technologies - people are being harmed by this choice. It's one thing when you have to target specific platforms and maybe Rust wasn't an option or whatever, but the reasons to choose unsafe languages at this point are vanishingly small. Zig is…

thank you for this truly deranged comment

Re: Zig: Build System Reworked

#250
post #8

After having used Zig for a couple of months now I am convinced it is a fantastic tool language. You just pick it up to hack some idea together freely. Every time I hit a wall, I find the creators have thought of it already and offers comfort. But nothing gets in your face how to use the programming language "correctly". For me it is now the go-to "tinker in my garage" language.

Is it really that good? My go-to "tinker in my garage" language is Python - lightweight syntax that stays out of your face, batteries included, packages for everything that's not included. What's Zig's edge?

Control. Its a replacement for C that is a lot nicer to work with.

So basically if you either need your Python code to interact with a native library or need more control in a specific place, you can use Zig there.

Zig makes it trivial to control which part of the code e.g allocate memory, so you can guarantee that your rendering or audio loop has no stuttering.

I would still keep Python as the main driver for where dev speed is the most important part.

Post reply on HN