3 ms·
I'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?
by wizhi 4y ago
I'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.
- still_grokking 4y ago> D is a good language and I wish it got more attention. D always looked nice conceptually. But the syntax! Most likely I would use it actively if it wouldn't look like C. The type annotations are "on the wrong side". Type inference is barely-there (`auto` is a joke). It's littered with superfluous braces and semicolons. I would really love it if they would change the syntax, and the result would look more like the new syntax in Scala 3.
- Touche 4y agoI think this is a little disingenuous. 99% of the D ecosystem uses the GC. You probably can't use most of it if you put @nogc on main. 99% of the D ecosystem of docs and articles assumes using the GC. You're going to struggle learning how to build something without it. You are kind of on your own. Also @nogc only was added in 2014, it's not that old. So given that, I honestly doubt that @nogc is much more mature than Zig, and is probably more difficult to learn how to use in practice, given that it's not a normal thing to do.
- WalterBright 4y agoD's main strength is its metaprogramming capabilities. It's memory safety features are very strong as well.
- bsder 4y agoIf I'm @nogc on D, what are the memory safety features I get?
- WalterBright 4y ago1. array bounds checking 2. pointers to the stack cannot escape the lifetime of the stack frame 3. cannot conflate pointers with non-pointers 4. cannot have uninitialized pointers 5. cannot do arithmetic on pointers (must use array slices, which come with array bounds checking) 6. cannot pass the same mutating pointer to a function more than once There are many more of these. They may seem burdensome and restrictive, but actually are not. If you really want to do these things, there is a "system" annotation that can be used.
- bsder 4y agoThanks. I don't know a lot about D and it's nice to get an absolutely definitive answer from the creator himself. :)
- WalterBright 4y agoYou're welcome. I really should write a supplemental page for the documentation that brings all these into one place. Then I can just link to it! Thanks for the inspiration.