On Monday, 25 December 2017 at 11:18:58 UTC, Joakim wrote:

IOW, it's not a matter of what D got wrong that it needs betterC but what those old languages got wrong that D must adapt to, because of all the old C/C++ code out there.

Rust is an example of a language that got it right. It is inherently memory-safe, can interface with legacy code requiring essentially no runtime, and still has optional reference counting, and plans for an optional garbage collector [1].

The key innovation in Rust is that it didn't bake such things into the language. That's where D got it wrong, requiring D to now back out such things with features like -betterC and @nogc.

There is hope for D, however. It may be possible to obsolete -betterC, by levereging design-by-introspection directly in the compiler (i.e. the compiler introspects the runtime, or the lack thereof). I'm researching this and the first of such PRs was recently merged [2]. Following this pattern, it may be possible to use D without the runtime by simply avoiding those D features that require it (assuming I can figure out how to get the implementation right). Users will be able to implement the full runtime, no runtime, and everything in between. In other words, pay for only what you choose to use.

Mike

[1] - https://www.rust-lang.org/en-US/faq.html#is-rust-garbage-collected
[2] - https://github.com/dlang/dmd/pull/7395

Reply via email to