4 ms·
I don't think it's meaningful to put Swift, Rust and Go in a single bucket when comparing them. They're languages targeting different levels of abstraction, wit
by int_19h 9y ago
I don't think it's meaningful to put Swift, Rust and Go in a single bucket when comparing them. They're languages targeting different levels of abstraction, with very different approaches as a result.
Some people refer to all of these as "better C++", but it's meant in very different and incomparable ways. For example, Rust is ostensibly a "better C++" in a sense that it retains the low-level, zero-overhead (no GC) etc nature and powerful metaprogramming facilities. Go is a ostensibly a "better C++" because it promotes higher-level, safer abstractions that are still "fast enough" (but not zero-overhead). Ditto Swift.
D is arguably in the same bucket as Swift, and partly as Go. I don't think it's very useful to compare and contrast it against Rust. And I think that of all of these, Rust is the only one that can truly claim to be a "better C++" in a meaningful way. Others are "something better than C++ for most apps you'd write in C++ today".
- pjmlp 9y ago> Others are "something better than C++ for most apps you'd write in C++ today". As big C++ fan and language geek, I am pretty confident that if Java and .NET had taken the route of all other alternatives in the 90's (Oberon, Eiffel, Modula-3, Delphi,...), C and C++ would be less relevant today than they turned out to be. This because many people make use of them, just because they are the only languages they know about compilers that produce AOT executables, with the option of static linking them. Maybe even Longhorn would have been a success, instead of having to wait for UWP with .NET Native.
- throwaway7645 9y agoI agree with your points. I do like to bring Nim up as it uses python like syntax with types and then transpiles to C. You get a fast and small native binary and can choose from 2 different GC or no GC. It has a small, but very active community.
- int_19h 9y agoIndeed. With C# especially it is rather ironic, because the timeline of its development closely overlaps with D - I remember learning the newly released C# 1.0 as I was experimenting with those early 0.x versions of D.
- donatj 9y agoI will argue that Go is more of a better C than a better C++
- paulddraper 9y agoAnd more of a spiritual successor than an actual one. You probably won't be writing kernels with it.
- throwaway7645 9y agoNo as Go has a GC. It's just supposed to be a fast server-side language without very complicated code. Go is mostly successful due to Google and filling a niche (fast, simple, concurrent, all thrown into a fat statically linked binary I think).
- pjmlp 9y ago> No as Go has a GC. So what, so do Oberon, Modula-3 and many others including D. Yet quite a few production OSes were even written with them, e.g. Native Oberon for the Ceres Workstation at ETHZ.
- throwaway7645 9y agoI think I'd rather not have GC in my OS. Oberon was a pretty small language, so perhaps the pauses were more acceptable.
- pjmlp 9y agoIt even supported live video editing. Pauses weren't an issue for users' productivity.
- throwaway7645 9y agoI'd have to know more details to see y that's not a problem. Vastly superior code, or just a very lightweight system.. I dunno.
- klickverbot 9y ago> D is arguably in the same bucket as Swift, and partly as Go. I don't think it's very useful to compare and contrast it against Rust. It is easy to claim how things "arguably" are, but without providing any justification that is not a very meaningful statement to make. D very much matches your definition of "low-level, zero-overhead (no GC) etc nature and powerful metaprogramming facilities" – the GC can be avoided easily enough. It can certainly claim to be a "better C++" in this sense. For instance, Weka.IO (a storage startup founded on D) heavily relies on D to offer exactly that, in order to implement a distributed file system with sub-100µs latency. The fact that you can also write Python-esque code during prototyping (playing fast and loose with the GC, etc.) doesn't detract from the core identity of the language as a tool for systems programming with zero-cost abstractions.
- dgfgfdagasdfgfa 9y agoHow is D's memory safety without the GC? How does it guarantee you don't use-after-free, de-ref nulls, buffer overflow, etc?
- WalterBright 9y agoGreat question! The answer is a bit more than a simple reply can do, so: Pointers Gone Wild: Memory Safety and D http://dconf.org/2017/talks/bright.html http://dconf.org/2017/talks/bright.html
- dgfgfdagasdfgfa 9y agoWalter, you're always so responsive in these threads! Cheers.
- hellcatv 9y agoIt seems like use-after-free is still a potential issue, even with those guard rails. Rust deals with those through named lifetimes --would those ideas be useful in D as well?
- mhh__ 9y ago