News for hackers. Stuff that matters.
Re:Zig's New Relationship with LLVM by gravitas on Monday September 28, 2020 @09:47AM (#24616539)
Similarly, I rolled back to the official docs from Master and the hello.zig from there is similarly nonop using the tagged 0.6.0 build: https://ziglang.org/documentation/master/

Please, please - make a Hello, World which is not so intrinsically tied to random features on Master to just work across all the iterations. Hello, World is supposed to be the simplest, non-breaking easy to compile no esoteric compiler feature thing in any programming language in the world.

Re:Zig's New Relationship with LLVM by AndyKelley on Monday September 28, 2020 @03:20PM (#24620296)
My friend Jeff Fowler wrote an excellent blog post diving deep, deep into this topic.

https://blog.jfo.click/hello-hello-world/

Re:Zig's New Relationship with LLVM by kristoff_it on Monday September 28, 2020 @09:55AM (#24616604)
Use std.debug.warn and you'll be fine with 0.6.0 and master. Right now there's no strict and methodical update path from one version to the next, but generally speaking changes to the language get special-cased into zig fmt.

For example the current `anytype` type has replaced `var` and running zig fmt on a project I hadn't updated yet changed all references.

That said, Hello World, when taken seriously, it's not that simple of a program and I'm working on a talk for Zig SHOWTIME[1] about it, titled "Advanced Hello World in Zig".

The TLDR is that Zig never had an easy builtin print function because it's important to let the programmer be precise about whether they want locking (or not) or buffering (or not). That's why the easy print function is in the debug namespace.

[1] https://zig.show

Re:Zig's New Relationship with LLVM by gravitas on Monday September 28, 2020 @10:04AM (#24616699)
Thank you (for both replies) and to everyone else, this makes it crystal clear what's going on - there's a lack of "hey everyone, this is very unstable at the moment and the basic internals are changing, using anything except the latest Github builds is highly discouraged" which might really help when added to the various places above.

I'm a toe-dipper -- I need to run and play with some sample code (basic Hello, World stuff) to see if I like the ergonomics and wish to continue looking deeper, when an article is posted on HN and piques my interest to go try out (zig) the easy route is taken - install what Arch has as the latest and just test it out with the basics. ("The learn guide says I must have 4 spaces, what if I use 2? yeah OK that still works")

Re:Zig's New Relationship with LLVM by kristoff_it on Monday September 28, 2020 @10:20AM (#24616858)
I think your point was fair and your approach is just as well. The reality is that we don't have a gigantic amount of resources right now. We don't have Google or Mozzilla backing the project, so most information out there is contributed by community members on their free time.

Take a look at other content by Andrew (https://andrewkelley.me) or from Zig SHOWTIME if you want to lazily evaluate Zig :)

Re:Zig's New Relationship with LLVM by minxomat on Monday September 28, 2020 @12:32PM (#24618419)
For a while there was a link to TIO (tio.run) on the zig homepage where you could play with it online. But for some reason it has been removed.
Re:Zig's New Relationship with LLVM by sobeston on Monday September 28, 2020 @02:39PM (#24619906)
The version that tio has is very old at this point. Godbolt stays up to date.
Re:Zig's New Relationship with LLVM by minxomat on Monday September 28, 2020 @07:11PM (#24622239)
There wasn't any incentive to update it once Zig removed it from the homepage.
[dead]
Re:Zig's New Relationship with LLVM by dang on Monday September 28, 2020 @07:39PM (#24622491)
This comment breaks the site guidelines. Please don't cross into personal attack in comments here, or generally be unkind or snarky.

If you wouldn't mind reviewing https://news.ycombinator.com/newsguidelines.html and sticking to the rules when posting here, we'd be grateful.

Re:Zig's New Relationship with LLVM by gravitas on Monday September 28, 2020 @05:46PM (#24621558)
This reply is rude and uncalled for, you created an account 28 minutes ago just to act like a condescending jerk?

    $ pacman -Q | awk '{print $2}' | egrep "^0\." -c
    257
Re:Zig's New Relationship with LLVM by candeira on Monday September 28, 2020 @10:22AM (#24616877)
> it's important to let the programmer be precise about whether they want locking (or not) or buffering (or not)

Or whether the function accepts naked types as parameters or error unions!

The debug namespace is indeed the right place for a wholly generic print. The first day I took Zig out for a spin, std.debug.warn briefly confused me by eating errors and printing their name instead of (as I expected for a short minute) giving a runtime error.

This is a good design decision for the debug namespace, but you don't want a regular call to print() to take an unwrapped error without complaint!

Re:Zig's New Relationship with LLVM by e12e on Monday September 28, 2020 @03:53PM (#24620627)
Reminds me of Bjarne Strostrup's old article on learning c++ as a new language - and how a simple program in c isn't that much simpler when you start to poke at the details:

https://www.drdobbs.com/learning-standard-c-as-a-new-languag...

https://stroustrup.com/new_learning.pdf