4 ms·
All Rust, D and Go pass as "better C++" To me, the evaluation goes solely as ecosystem vs. ecosystem There D is ahead not so much by number of features, than
by baybal2 8y ago
All Rust, D and Go pass as "better C++"
To me, the evaluation goes solely as ecosystem vs. ecosystem
There D is ahead not so much by number of features, than by lack of showstopper flaws
- mhh__ 8y agoGo's lack of generics make it a strange choice to replace C++, philosophically rather than functionally.
- earenndil 8y agoI wouldn't say go is at all a better c++. It has very different stated goals and a different philosophy. As for d and rust, they improve on c++ in very different ways, just because they're both improvements on c++ doesn't mean they're the same. For example: * D has generally better metaprogramming, however, rust has real macros * D has a garbage collector and defaults to code being memory-unsafe. Rust uses ownership semantics and defaults to safe code. * Rust has only an llvm-based compiler (although possibly moving to a self-hosted one soon?). D has a self-hosted, gcc-based, and llvm-based compiler.
- mratsim 8y agoI don't understand the "D has generally better metaprogramming, however, rust has real macros" statement. Or do you mean like even though Rust allows you to work on AST, it's too clunky compared to D string mixins?
- earenndil 8y agoI don't mean the string mixins, I mean more the template metaprogramming.
- creatornator 8y agoI think you've got the wrong idea on "self-hosted". That just means the compiler is written in the language itself. Rustc is written in rust, so it is self-hosted (even if it has an LLVM backend). And likewise, all three D implementations are written in D, despite having either baked-in code generation, a gcc backend, or an llvm backend. You can check the repos on github: all three of DMD, LDC, and GDC are written in D-lang, so they are self-hosted.
- arunc 8y agoPersonally/Syntactically I've found that coding in D is much pleasant than C++. Consistent '.' operator for the equivalent '.' '->' '::' in C++, template meta programming for humans, modules, UFCS, etc, etc. But a killer feature that's available in C++, but not available in D is pure RAII idiom. Sure D does scoped destruction (via struct's destructor), but is in no way equal to the contructor+destructor combination in C++. struct's in D don't have default constructor, so RAII in D is just incomplete. Automem[1] is a boon for D, but is useful only for heap memory resource. Not for all kinds of resources (like locks, etc). On the other hand D has scope exit/failure, which is not available in C++. [1] https://dlang.org/blog/2017/04/28/automem-hands-free-raii-for-d/ https://dlang.org/blog/2017/04/28/automem-hands-free-raii-fo...
- FeepingCreature 8y agoYou can disable the default constructor on structs with @disable this(); Then the only proper way to initialize the struct is with its parameterized constructor.
- pjmlp 8y agoI would add Ada and Swift as well.