4 ms·
D is the systems language I enjoy writing the most out of C++, Rust, and Go. It feels a lot like a mix between C# and JS, but at the low level access of C++.
by gavinray 4y ago
D is the systems language I enjoy writing the most out of C++, Rust, and Go.
It feels a lot like a mix between C# and JS, but at the low level access of C++.
It has a lot of unique features but the "killer feature" by far for me is Contract Programming and Invariants
https://tour.dlang.org/tour/en/gems/contract-programming https://tour.dlang.org/tour/en/gems/contract-programming
Invariants changed my life, so much so that I built a GCC plugin to add them to C++
It used to be the case that the developer tooling wasn't very good, but the "code-d" VS Code plugin has matured greatly in the last few years and has some features you won't find even in bigger languages
(Like the ability to colorize source code lines with GC profiling info or test coverage status)
---
Another useful bit of info is that AddressSanitizer and tools like LLVM libFuzzer work with the LDC compiler
- agumonkey 4y agoIs your gcc plugin a personal project or something you built for a team ? I find the idea brilliant in itself but I wonder if other people felt the need, and uses / enjoy this kind of improvements. I want to add profile/coverage info in emacs now :) D is a strange point in PL landscape, it's been here for ages, never took off (for some value of taking off) even though it seems there's a lot to like.
- gavinray 4y agoIt was a small personal project, I posted about it here some months ago fwiw: https://news.ycombinator.com/item?id=34211482 https://news.ycombinator.com/item?id=34211482 D has no (FAANG) corporate sponsor and it does all things well/has no particular speciality, these two things make it hard to compete with marketing of other languages I think There's a small but dedicated and active community
- agumonkey 4y ago> does all things well a great feature IMO, helps communication in large teams I believe (in the imaginary world where teams use D :) thanks for the link, have the best day
- mhh__ 4y agoThis world is not imaginary
- agumonkey 4y agoEven better then :) Maybe it's like some languages that don't chase growth/viral/visibility but exist calmly doing work.
- gavinray 4y agoI mean to say it's sort of a solid general purpose language/jack of all trades, with no particular speciality or thing it's deficient at
- pjmlp 4y agoD has suffered from lack of corporate sponsor, and there were a couple of reboots trying to chase the next big thing that would bring more people in, this allowed other language ecosystems to improve their shortcomings, thus reducing the distance in language features. From my point of view in systems programming, experience with Oberon back in the day and such, I would really like that we would be talking more about D and less about Rust and Go, but unfortunately it isn't how things went.
- shrimp_emoji 4y ago>D has suffered from lack of corporate sponsor But Digital Mars is a company. D: >From my point of view in systems programming, experience with Oberon back in the day and such, I would really like that we would be talking more about D and less about Rust and Go, but unfortunately it isn't how things went. As someone who has no idea what Oberon is or does sorry and believes that using anything other than Rust is literally pouring blood on your hands and de facto proscribes you in the future inquisitions on digital harm through software, why?
- tmtvl 4y agoOberon is the language Niklaus Wirth designed after Pascal and Modula.
- dataflow 4y agoD never took off IMO because you can't abstract away a GC. The moment your callees rely on a GC, you have no choice but to have one in your program. The idea that you can avoid it in practice just because the language doesn't mandate it is therefore an illusion, and so it's not surprising at all that it isn't replacing C++.
- layer8 4y agoI mean, the same is true for C++. If some C++ library you use employs GC, you can’t abstract that away either. The actual difference is how frequent such libraries are in the respective ecosystem.
- dataflow 4y agoI basically said as much https://news.ycombinator.com/item?id=34850130 https://news.ycombinator.com/item?id=34850130 Though, I'm not sure you could even have a precise GC for C++ even if you wanted to, given the way most C++ is written.
- masklinn 4y ago> The actual difference is how frequent such libraries are in the respective ecosystem. That’s a difference without a distinction: people will use the defaults unless they can’t. So in C++ libraries will avoid GCs unless their work basically requires it, whereas in D they’ll require it unless the author is constrained to a nogc requirement.
- suby 4y agoThis is the logic I personally used in deciding not to use D.
- dataflow 4y agoYeah, I'm pretty sure it's the reason many C++ folks reject it. It's kind of ironic that having the "wrong" useful feature can hurt you, but that seems to be what's happening here. I feel like they might actually have a shot at solving it by literally dropping GC support, but it's hard to say at this point. I don't know if the standard library still has anything that needs a GC, but making sure that's not the case might be a good first step if they're ever interested in going in this direction.
- deleted 4y ago[deleted]