7 ms·
Zig 0.3.0 Released
- oblio 8y agoIf Andy's watching, congrats! Two minor things: > zig init-lib and init-exe Wouldn't these be better off as "zig init lib" and "zig init exe"? I.e. do what git did when it switched from stuff like "git-annex" to "git annex": switch from compound command names to subcommands. Easier mentally to follow and remember. There's also this: > all control flow occurs exclusively via keywords. This will probably never happen cause C looms too large in Zig's world, but I wish "*" and especially the super non-intuitive "&" go the way of the dodo and some short keywords replace them. Perhaps "ptr" and "deref"? This is technically just bikeshedding, but look at Rust threads: besides the obvious #1 difficulty of the borrow checker and ownership, the #2 complaint is that the syntax is weird due to sigils. "Modern" programming languages don't use many sigils, if any: Javascript, Python, Java, C#, etc. It's not fair since those languages are GCed, but most people will be familiar with them, not with C, these days. I know that it's doubly unfair since Zig's target is C, so it's expected that new Zig developers know C, but you want to get new developers wherever you can get them, in my opinion :)
- deleted 8y ago[deleted]
- simias 8y agoThe sigil thing is definitively a bikeshed. For one thing besides Python I don't don't know why you consider that JS, Java or C# don't use many sigils, these languages just happen not to have C-style pointers so they don't need that particular bit of syntax. More generally using C-style syntax means that C and C++ coders will be at home, while people from other languages will have to familiarize themselves with the concept anyway, sigil or not. Beyond that, I don't think I've seen any serious study on the acceptable level of sigils to maximize productivity and readability in source code, as far as I can tell it's really just a matter of opinion. Personally I'd take C syntax over Python every day of the month, and I've written quite a bit of Python. My only sigil-related problem with C is that '->' should really just be '.' IMO.
- espeed 8y agoThere's was a talk at StrangeLoop a few years back about a language syntax being designed based on user feedback from its ongoing usability studies. I'm on my phone now, but I'll try to find and post the link later when I'm at my computer if someone else doesn't find it first.
- Quekid5 8y ago> his will probably never happen cause C looms too large in Zig's world, but I wish "*" and especially the super non-intuitive "&" go the way of the dodo and some short keywords replace them. Perhaps "ptr" and "deref"? Beware Stroustrup's Rule[0] :). [0] https://thefeedbackloop.xyz/stroustrups-rule-and-layering-over-time/ https://thefeedbackloop.xyz/stroustrups-rule-and-layering-ov...
- oblio 8y agoWell, I was expressing more of a personal preference but I can't miss the opportunity to take a jab at Stroustroup, even if the rule seems good and valid, something went astray when he designed C++, so I guess Rule[0] was ok, the problem was with rules [1] to [99] :p On a more serious note, I think that this word form is concise enough and might emphasize code smells in a more modern language, where stuff like * *a should be super rare, IMHO.
- sephware 8y agoCan anyone with more experience/understanding of Zig give an elevator pitch about why and when I would use Zig? I love the concept of a low level language that's not C, but the home page doesn't paint a clear picture to me about what its strengths are and in what situations it really shines, and what trade-offs it makes to get there.
- MaxBarraclough 8y agoI don't know of an 'objective' thorough evaluation of Zig as it stands, but I hope these are of interest: Previous HackerNews discussion on Zig: https://news.ycombinator.com/item?id=17184407 https://news.ycombinator.com/item?id=17184407 Also, perhaps not as objective as you'd like but still good resources: Whirlwind tour of the basic thinking behind Zig: https://andrewkelley.me/post/intro-to-zig.html https://andrewkelley.me/post/intro-to-zig.html A ~50 minute talk on Zig, by its creator: https://www.youtube.com/watch?v=Z4oYSByyRak https://www.youtube.com/watch?v=Z4oYSByyRak
- jeremycw 8y agoThe short of it is C without the warts plus a few small quality of life improvements. The long of it: The competition right now in this space as I see it is: C, Rust, C++. Even C++ doesn't fully fit because you have to turn off language features like exceptions to have the guarantees you need for systems programming. So in turn. C hasn't really changed in 40 years so all it's warts are still intact and has specific pain points that will never be addressed. C++ conversely has added every language feature plus the kitchen sink over the past 30 years. People say: "Just don't use the features you don't want", but that is unrealistic when you have to interoperate with third party libraries etc. If you have to drop a large portion of the C++ ecosystem to use the subset of the language you like then you've lost a major benefit of choosing C++ in the first place. Rust, while being more thoughtful about it than C++, has provided a large set of features to work with. It is a much bigger language than C. It's also taken a very opinionated stance on safety with the borrow checker which causes a large learning curve and a lot of mental overhead. Finally Zig is an attempt to be more safe than C where it can without being as overbearing as Rust. Add just the necessary features that a huge boost to quality of life while not flooding the programmers mental model of the language. I think of it as kind of a C+.
- unique_id 8y agoIf anyone is interested, I'm using Zig full-time. I switched from C# to C++ for game development but I had immense difficulty accepting the language, so when I heard of Zig I gave it a go and I've been very happy with it. This is a serious project that I'm working on. The 'engine' uses the Vulkan graphics API, cache efficient design, scales to the number of cores, game logic is multithreaded, AVX is used, and so on. I only mention this to hopefully get people interested in Zig. I'm not ready to share screenshots yet and I'm certainly not going to be advertising my game here.
- azhenley 8y agoAny particular reason why you chose Zig over Nim? Or Go or Crystal? I've been trying out all of these languages but haven't decided which one to dive into completely.
- TurboHaskal 8y agoNim, Go and Crystal are garbage collected.
- eggy 8y agoI tried, and really liked Nim, and I believe the custom GC settings would allow for game dev for the types of games I try and make, however, I am biased against the sort of Python syntax and prefer Lisps or standard C-style syntax. This is totally subjective. I can't speak to Go or Crystal, although Go looks like C to me!
- dom96 8y agoNim has a soft real-time GC designed for game development. https://nim-lang.org/docs/gc.html https://nim-lang.org/docs/gc.html I'd also be curious why the OP decided not to use Rust.
- keldaris 8y agoI've followed Zig's progress with some enthusiasm, but would have considered it too immature for a serious project at this point. In that vein, a few questions about your experience: 1) What's your workflow like in terms of tooling? Coming from C# and C++ people are typically used to great IDE support, debugging and profiling tools, etc. Zig doesn't have any of that. How do you work around it and do you find the experience reasonably productive? 2) How do you deal with the language still rapidly evolving? Do you run the latest nightlies or freeze a particular compiler version and update periodically? 3) What are the most important things Zig gets you over the traditional gamedev approach of using a restricted subset of C++ (in some cases literally just C with function/operator overloading for basic math and a few other convenience features)?
- moron4hire 8y agoHeh, if you ever came into a place that had used Zig and we're now transitioning to a different language, your job would be to--literally--"remove all Zig".
- AndyKelley 8y agoToo late. All your codebase are belong to us.
- moron4hire 8y agoI would call all the programs "gentlemen" and inform them they were on their way to destruction
- donpdonp 8y agothe amount of development described in detail the release notes is simply amazing. thanks for your work and i'm excited to see zig continue to progress.
- crazygringo 8y agoJust a small suggestion, but: > Zig intends to be so practical that people find themselves using it even if they dislike it. feels awfully condescending to my ears personally, in an I'm-smarter-and-know-better-than-you kind of way, even if you didn't intend it like that. Just my unsolicited $0.02, but I'd recommend a more objective and non-loaded description something along the lines of "Zig's primary motivation is practicality, and therefore avoids issues with C such as <x, y, z>".
- jphoward 8y agoAgreed, the opening paragraphs talk about "overthrowing C", the release being "massive", lots of "I" and "my", and also the statement you highlighted. I'm sure this an excellent language, but it sounds like it's written by a megalomaniac. I'm sure it's not intended that way, but I would advise the author to tone it down a bit so people don't take it the wrong way.
- edmundhuber 8y agoTo throw in dissenting opinion: I feel like that gets the point across to C programmers like me.
- audunw 8y agoSo happy to see this language develop rapidly. I want Zig for simple, rapid and fun microcontroller development. There's just no satisfying options right now. I played around with it some months ago. It was an adventure so to speak. Even discovered bugs in LLVM itself. Andy was very responsive to bug requests, so I got a demo working pretty quickly. I'm hoping to do another pass soon, perhaps contribute a bit to the compiler. The demo is here: https://github.com/skyfex/zig-nrf-demo https://github.com/skyfex/zig-nrf-demo Probably doesn't work anymore.. but that's the way it goes with a developing language :) That's part of the fun
- ac29 8y agoI've had fun writing some stuff in CircuitPython [0] (a fork of MicroPython mostly geared towards Adafruit microcontroller boards). At the moment it is geared more towards educational and hobbyist uses, but there is a quite a bit you can do with it. [0] https://github.com/adafruit/circuitpython https://github.com/adafruit/circuitpython
- edflsafoiewq 8y agoHow does generic code work in the absence of destructors? Is there an analogue of psuedo-destructors?