6 ms·
The thing that caught my eye in the release notes is the blurb about Zig: Zig is a general-purpose programming language and toolchain for maintaining robust, o
by azhenley 6y ago
The thing that caught my eye in the release notes is the blurb about Zig:
Zig is a general-purpose programming language and toolchain for maintaining robust, optimal, and reusable software. In addition to supporting LLVM as an optional backend, Zig links Clang and LLD to provide an out-of-the-box cross compilation experience, not only for Zig code but for C and C++ code as well. Using a sophisticated caching system, Zig lazily builds from source compiler-rt, mingw-w64, musl, glibc, libcxx, libcxxabi, and libunwind for the selected target - a “batteries included” drop-in for GCC/Clang that works the same on every platform.
- m4r35n357 6y agoYep, that is a highly significant feature! https://andrewkelley.me/post/zig-cc-powerful-drop-in-replacement-gcc-clang.html https://andrewkelley.me/post/zig-cc-powerful-drop-in-replace...
- Shoop 6y agoI vouched for your comment but it looks like you may be shadow banned. Just an FYI -- you might want to email the mods, they're quite nice people.
- seg_lol 6y agoWhat specifically, that they mention Zig or that you learned of Zig or that Zig has a lazy build system or ??? The thing I really find interesting about Zig is the compile time function evaluation [1] and how it can stand-in for macros, code generation, precomputing values, etc. I think of CTFE as a continuation that comes baked into the binary from an earlier point in time, T-days_ago. As for this release, I am stoked to see Flang making progress. I am excited about Fortran in the browser. The interesting thing of note is that Zig is in the process of creating their own backend, but I don't see them dropping LLVM any time soon. An alternate backend is a great way to find bugs in codegen. [1] https://andrewkelley.me/post/zig-programming-language-blurs-line-compile-time-run-time.html https://andrewkelley.me/post/zig-programming-language-blurs-...
- mhh__ 6y agoI'm probably biased but comptime doesn't seem as elegant as the mechanism D provides for doing CTFE (i.e. I prefer a separation of quasi-template parameters)
- nikki93 6y agoCan you eg. generate a struct with fields based on an existing struct or on a comptime array in D? Can you receive a structure literal of anonymous type and iterate over it at compile time? (curious bc. these were a few things I found straightforward in Zig, and in C++ the main proposals involve tons of new metaclasses and reflection features for)
- mhh__ 6y agoYes to all points. D doesn't go the C++ route, the way code like this works is via generating new code (in text) at compile time which the compiler then compiles (duh) and replaces the mixin statement within. Here's an annotated example of these features in use https://run.dlang.io/is/2b5zgC https://run.dlang.io/is/2b5zgC
- fithisux 6y agoBrilliant.
- Matheus28 6y agoThat is beautiful. I wish C++ had something like that... Perhaps in addition to its current template system. Having a separate build pass to generate files is annoying.
- pjmlp 6y agoIt does, via constexpr, which just got more expressive in C++20, and is the basis for the ongoing compile time reflection work on C++23. Code injection might eventually come later via Microsoft's ongoing research in C++ metaclasses. "Dynamic Polymorphism with Metaclasses and Code Injection" https://www.youtube.com/watch?v=8c6BAQcYF_E https://www.youtube.com/watch?v=8c6BAQcYF_E
- jcelerier 6y agoI've been building a similar toolchain which uses the same version of clang / libc++ / etc everywhere for my own software and things are so much more sane than trying to use GCC/libstdc++ on Linux, Clang/libc++ on macOS and MSVC on Windows which all have various behavior and performance divergence & pitfalls. CI still tests GCC and MSVC (except that MSVC of course has been ICE'ing on my project for the last six months), but all the releases are built with clang and my sleep quality has never been better :-)
- butterisgood 6y agoi recall zig being mentioned in the last ... I don’t know how many releases.