12 ms·
Zig 0.7.1 Released – 69 bugs fixed
- dbandstra 6y agoIt's good to see the project soldier forward! Some things I am excited about for the future: - Continued progress on the new "stage2" compiler, which is written in Zig itself (long promised, work started in earnest I think about six months ago). There will be an optional non-LLVM backend this time, which is good news for build times. Even in debug mode, most of build time currently is spent waiting for LLVM. - Incremental compilation with live reloading (in-place binary patching). The stage2 compiler is being written with this feature from the start. - I can't find the link, but I believe the plan for stage1 (the current compiler written in C++, with all its warts) is to simply delete it. Since the new compiler will also support compiling to C, the devs will simply have stage2 compile its own source into C at some point, and that will be the stage1 from that point forward.
- AndyKelley 6y ago> I can't find the link Here you go! https://github.com/ziglang/zig/issues/6378 https://github.com/ziglang/zig/issues/6378
- acqq 6y agoSo did I understand correctly? The "bootstrap" stage which is best to be in C (for the targets which don't have LLVM) will be just the output of the compiler compiling itself to C, and that will be regularly produced and pushed as the compiler grows? And that's one of the steps to make it LLVM independent? P.S. Amazing work up to now! Kudos! I'm a fan just for everything it does what other language designers ignore, like designing the language to both compile and link fast. Cross compiling always available is a masterpiece. I guess that feature wouldn't have to be present on the platforms which don't have LLVM, if the language is to work on such too?
- wyldfire 6y agoWow, a C backend sounds interesting. Should be super portable if they maintain it alongside LLVM.
- vijaybritto 6y agoIn case you didnt know, the person whom you replied to is the creator of zig language.
- Karupan 6y ago> Incremental compilation with live reloading (in-place binary patching) That is awesome! I’ve longed for such a feature when I work with Go and Rust although Go is usually fast enough that I can use a custom watch script.
- MaxBarraclough 6y agoSo this is purely a bug-fix release, with no changes to the language itself? I hope Zig succeeds in becoming a stable and minimal language. Few languages manage it, they tend to steadily bloat over time. The most obvious exceptions are C and Scheme, which are famously ascetic.
- dbandstra 6y agoZig is a lot more complex than C, but I think most of the language complexity came from filling in gaps rather than tacking things on. For example I think they have settled on having no dynamic dispatch feature (interface, trait, virtual method, etc) at the language level. The comptime feature is flexible enough that userland approaches seem to be good enough. I bet a lot of "complexity" in the future will come from competing idioms used in various third party libraries.
- MaxBarraclough 6y agoC is unusual though in that it's a minefield of undefined behaviour. It's very easy to think you truly understand the language but to have no real understanding of its many curious rules around undefined behaviour. You can't take a try it and see attitude, you need to be a language-lawyer. Of course, even if you understand the rules you'll still accidentally write code that invokes undefined behaviour, which is much of the reason languages like Zig exist.
- pjmlp 6y agoC is a great language for pub quizzes, because so many think mastering K&R C book is all it takes.
- MaxBarraclough 6y agoHere are your pub-quiz questions: https://www.gimpel.com/archive/bugs.htm https://www.gimpel.com/archive/bugs.htm
- jeron 6y agoNice
- jmcz 6y agoNice
- afaq404alam 6y agoNice
- asimjalis 6y agoWhat is the use case for Zig?
- jamii 6y agoSimilar to C but less footguns, less error-prone error handling, better meta-programming, really good C interop. If you're writing C (or maybe even C++) on a platform that llvm supports, it's worth checking out.
- AndyKelley 6y agoZig is a general purpose programming language, so it's actually easier to answer the question, what kinds of programming are not a use case for Zig!
- Santosh83 6y agoAnd what would those be, in your opinion?
- dnautics 6y agowriting code for gpus, writing "code" for FPGAs/ASICs, writing excel macros, writing MAX presentations... Probably most websites (not counting any WASM layers...)
- AndyKelley 6y agoThere are a few categories: * Things that would be in scope, but the Zig project is not yet capable of supporting. An example of this would be compiling stuff to GPUs, e.g. SPIR-V. Such things are planned but not implemented. https://github.com/ziglang/zig/issues/2683 https://github.com/ziglang/zig/issues/2683 * Things that will never be in scope. An example of this would be code obfuscation, which is a use case the Zig project does not recognize. * Object formats that are drastically incompatible with the von Neumann architecture. It would be infeasible for Zig code to be compiled to such things. For example, attempting to compile to CSS (Cascading Style Sheets). I think that's it. Anything else would be supported, provided there were enough people interested in providing maintenance for the respective parts of the codebase.
- helloycombinat 6y agoThe author has a lot of jokes in his presentations. I wonder if he specifically stop fixing bugs once he got to that number
- saagarjha 6y agoNice progress! I'm curious how project management works; do you pick specific releases to just be bugfixes or did it just shake out this way?
- AndyKelley 6y agoThis is a bug fix release only - only bug fixes have been pulled into the 0.7.x branch. The release is cut when all the issues with the 0.7.1 milestone are fixed. The main branch has new features already that are not in this release. They will be available with 0.8.0.
- gameswithgo 6y agonice
- billsix 6y agoWith respect, although I think zig is very fascinating as far as language design and is great work, I've had trouble compiling most example zig programs, which I assume worked on older versions of zig. This minimizes my motivation to continue to learn zig. Please accept pull requests that fix older example code, or please make the provided examples work on newer versions of zig. https://github.com/andrewrk/sdl-zig-demo/pull/8 https://github.com/andrewrk/sdl-zig-demo/pull/8
- AndyKelley 6y agoYou left that PR open for 7 days before closing it? Average PR lifetime in ziglang/zig repo itself is about 12 days. This is actually pretty fast compared to other projects. I'm proud of the fact that the oldest open PR in zig is from October 2, 2020 - only 2 months and 11 days old. From the perspective of someone submitting a pull request, it's frustrating to not get a response within a day or two. I completely get that. But it's just not possible when you have a team of 1-3 people who are able to engage with PRs, and hundreds of people submitting PRs. Since this project has started, the Earth has completed 1732 rotations, and yet 2877 pull requests have been closed. That's 1.7 per day, including weekends and holidays. Consider that for the first couple of years of this project, I was moonlighting it with a day job. I'm not trying to throw shade at you, just saying, man, cut me some slack. I'll get to your PR.
- billsix 6y agoI had been unaware of the volume of PRs that you receive, apologies, I had thought that my PR was just ignored. Thanks for your reply and thank you for Zig. I'll reopen that particular issue, and will try to fix any example zig apps that I can't compile, and will submit PRs for them.
- AndyKelley 6y agoI look forward to merging them :)
- wyldfire 6y ago
- briandilley 6y agoNice
- philonoist 6y agoIs zig as production ready as Rust?
- networkimprov 6y agoZig will be production-ready (for some definition of "production") when it reaches 1.0. The question of when will Zig be as mature as Rust is impossible to answer.
- jorangreef 6y agoIn the general sense, no, not yet, of course, but in one sense, Zig is probably more production ready than Rust, for example on embedded systems with obscure architectures where OOM-safety is essential. Here is a talk on using Zig in exactly this kind of environment in production: https://www.youtube.com/watch?v=124wdTckHNY https://www.youtube.com/watch?v=124wdTckHNY It also depends on your project's timeline. If your project will be stable in a year or two, that might well coincide with Zig's stability program. If Zig's design goals suit your project then it might be worth investing for the long term and gaining deep understanding of the language as it grows.
- roblabla 6y ago> In the general sense, no, not yet, of course, but in one sense, Zig is probably more production ready than Rust, for example on embedded systems with obscure architectures where OOM-safety is essential. I mean, FWIW, Rust is fairly ready for embedded systems, even when OOM-safety is essential. There are crates dedicated to providing fallible memory allocation primitives for exactly those use-cases. With that said: I do believe Zig would work a lot better than Rust in severely resource-constrained environments. Rust has a few pitfalls that can easily cause a code size explosion (anything using core::fmt, for instance). And zig's constexpr appear more powerful than Rust's current stable const fn, which can be critical to writing maintainable, small code. I've worked on a Rust reimplementation of a bootloader that had to fit in 8KiB of RAM, and I often went over accidentally by having a panic handler pull core::fmt. I haven't tried Zig for the same use-case (yet), but from a cursory glance, it appears to be less prone to this kind of code-size explosions.
- jokoon 6y agoThere are several similar languages: V, elixir, D, nim. But zig seems to really the best of all of those, at least it's my favorite. Any other similar language? (except go and rust, of course)
- tabascco 6y agoThere's Odin and Beef Lang.
- alekq 6y agoNot sure that elixir fits into that comparison... Maybe Crystal, Free Pascal even.
- cies 6y ago> Any other similar language? If Elixir is in, then Kotlin, Crystal and OCaml should be in as well. I don't think Elixir is similar though, not at all. > Any other similar language? I only think Rust, C, C++ and Go are similar enough, in order or similarness.
- loevborg 6y agoIf you're adventurous and like Clojure, check out liz, a Lisp-flavored zig https://github.com/dundalek/liz https://github.com/dundalek/liz
- nerdponx 6y agoI like this trend of "Lisp that compiles to X". More examples: * Clojure (JVM): https://clojure.org/ https://clojure.org/ * ClojureScript (JavaScript): https://clojurescript.org/ https://clojurescript.org/ * Fennel (Lua): https://fennel-lang.org/ https://fennel-lang.org/ * Hy (Python): https://docs.hylang.org/ https://docs.hylang.org/ * Lisp-Flavored Erlang (BEAM): https://lfe.io/ https://lfe.io/ And there's a similar growing trend of "strongly-typed functional language that compiles to X": * Elm (ML inspired -> JavaScript): https://elm-lang.org/ https://elm-lang.org/ * Elixir (Its own thing -> BEAM): https://elixir-lang.org/ https://elixir-lang.org/ * Fable (F# inspired -> JavaScript): https://fable.io/ https://fable.io/ * PureScript (Haskell inspired -> JavaScript): https://www.purescript.org/ https://www.purescript.org/ * ReasonML (ML inspired -> JavaScript): https://reasonml.github.io/ https://reasonml.github.io/ * Teal (Lua with strict type annotations -> Lua): https://github.com/teal-language/tl https://github.com/teal-language/tl As well as the gazillion languages that compile to and interoperate well with C, such as Nim and several Scheme dialects (Chez and Chicken, probably others I'm forgetting). Oh and Haxe, which apparently can compile to like 10 different languages and I don't understand why it isn't more popular. I like all of these languages because they don't require the user to switch to a different library ecosystem in order to use a programming language that they find more comfortable/enjoyable/powerful/expressive. I consider this extremely important because of how complicated some low-level protocols and systems can be, and reimplementing everything again for every new language is a waste of effort in my opinion. Also, the proliferation of things that specifically compile to JS enforces a only-half-joking saying I heard a long time ago: JavaScript is a better compiler target than programming language. I think I've heard the same said about C as well.