4 ms·
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/docu
by gravitas 6y ago
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/ 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.
- kristoff_it 6y agoUse 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 https://zig.show
- gravitas 6y agoThank 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")
- kristoff_it 6y agoI 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 https://andrewkelley.me) or from Zig SHOWTIME if you want to lazily evaluate Zig :)
- minxomat 6y agoFor 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.
- yamirui 6y agoThe only thing that's lacking is your understanding of semver. Zig is currently 0.6.0, you see that first number? This alone is a clear indication that nothing is truly stable and anything can disappear at any time for any reason.
- candeira 6y ago> 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!
- e12e 6y agoReminds 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-language/184403651 https://www.drdobbs.com/learning-standard-c-as-a-new-languag... https://stroustrup.com/new_learning.pdf https://stroustrup.com/new_learning.pdf
- AndyKelley 6y agoMy friend Jeff Fowler wrote an excellent blog post diving deep, deep into this topic. https://blog.jfo.click/hello-hello-world/ https://blog.jfo.click/hello-hello-world/
- nicka 6y agobbbbbbbbbbbbbbbbbbbbbbbb