5 ms·
From the article > D also has a @nogc mode, but it feels like giving up on 60% of the language’s power. Without the GC, D has exactly the same 'power' as Zig
by renox 4y ago
From the article
> D also has a @nogc mode, but it feels like giving up on 60% of the language’s power.
Without the GC, D has exactly the same 'power' as Zig have..
I feel that the poster is a bit misleading: he chose Zig instead of D because Zig, being newer, is more fashionable, not because of an imaginary technical reason.
If there's a technical reason, it's not written in the article.
- djha-skin 4y agoIt's not really technical though is it? It's the community around D, the micro design decisions. If everything online presupposes you're using garbage collection most of the time, if everything in the language also makes that supposition sure possible to still go against the grain but it does feel like you're going against the grain. Feel and community support is as important as anything else in a language decision.
- faraaz98 4y agohttps://ziglang.org/learn/why_zig_rust_d_cpp/ https://ziglang.org/learn/why_zig_rust_d_cpp/
- peoplefromibiza 4y agohonestly this does not contradict the claim that D is equally powerful, if not more powerful, than Zig. It is, at least, more battle tested.
- henry_viii 4y agoSome of the arguments listed in the page are misleading: > Zig is a programming language, but it also ships with a package manager Which is not true: https://github.com/ziglang/zig/issues/943 https://github.com/ziglang/zig/issues/943 > Zig has no macros and no metaprogramming Literally from Zig's homepage (https://ziglang.org/ https://ziglang.org/): "Comptime - a fresh approach to metaprogramming" The rest of the arguments are very weak in my opinion.
- G4E 4y agoEven the first argument "no hidden control flow" is disingenuous : either the object you are summing are complex and you have to call a custom function to define what "summing" means in that case (you need to provide the summing function), or those are a primitive type and you're just calling a function builtin the language itself. In every case, you are calling a function ...
- tosihakkeri 4y agoDon’t you people have anything better to do?
- messe 4y ago> or those are a primitive type and you're just calling a function builtin the language itself You’re thinking at a different level of abstraction to the Zig developers. Summing a primitive type is going to be turned into a couple of machine opcodes (but no branch instruction) and will usually be constant time, whereas an explicit function call will require pushing pc to the stack and jumping elsewhere, executing any number of instructions once there, taking an arbitrarily long time, making it more difficult to reason about.
- mh7 4y agoDoes zig plan on not supporting microcontrollers or not using "/" for integer division? Because on your typical arm mcu, x/y is a function call to a definitively non-constant time function. And lets not forget soft-fp. Every single floating point op is a function call...
- defen 4y agoA better way to think about it is: for a given line of code, how much context do you need in order to understand what function is actually going to be called? Yes, some compiler-rt or soft-fp function might get called but you know that's happening and what it does. With most languages you need significantly more context than you do in Zig - in C you need to know what preprocessor shenanigans might be going on; in C++ pretty much anything could be happening (operator overloads, virtual functions, constructors, destructors, who knows what else). With Rust you need to know what traits are imported, and if proc macros are involved then anything goes.
- wizhi 4y agoI've never used D, but aren't you kind of making the author's point? If you disable GC in D, and end up with something equivalent to Zig, then why not use Zig?
- killingtime74 4y agoI’m not using either (Rust fan) but D is 21 years old and Zig is not even 1.0. If it’s the same “power” why would we use something less proven
- wizhi 4y agoBecause otherwise, we'd all still be writing FORTRAN. I get your point, but it's as equally hindering of progress as it is valid.
- killingtime74 4y agoTrue enough on Fortran. I like Zig but not sure what it will stabilise on yet so will hold off.
- modernerd 4y agoD has been in development since 1999, so it's more complete than Zig and its ecosystem is bigger. It is not just “Zig with GC”. D has: - Multiple production-ready compilers. (Zig does not claim to be production-ready yet.) https://wiki.dlang.org/Compilers https://wiki.dlang.org/Compilers - A more stable API. (Zig's authors rightly expect it to change before 1.0.) - A package manager (dub) and repository: https://code.dlang.org/ https://code.dlang.org/ (Zig will get support for these but doesn't even have an HTTP client needed to back package fetching yet.) - An HTTP server and client with SSL/TLS support. (Zig is too new to have these, although community libs are starting to spring up to fill the gaps.) - Better documentation, including a very accessible tour at https://tour.dlang.org/ https://tour.dlang.org/ and books such as http://erdani.org/tdpl/ http://erdani.org/tdpl/. Zig may get all of these in time but D had quite the head start. D is a good language and I wish it got more attention.
- forgotpwd16 4y ago>he chose Zig instead of D because Zig, being newer, is more fashionable Maybe. But could as well be the GC stigma being too strong. It isn't without reason that there's a post on official blog named "don't fear the reaper."
- pron 4y agoZig's power doesn't come from the language features it has but from those it doesn't. Its killer feature is that it's a small language that can be fully learned in a couple of days (if you're familiar with some low-level programming). Simplicity is the one feature you can never add to a language that doesn't already have it and, for many, it is one of the most valuable feature.
- WalterBright 4y agoThe gc is very simple to use, that's the whole point of it.