D - Unsafe and doomed

Kelet kelethunter at gmail.com
Fri Jan 3 18:27:23 PST 2014


On Saturday, 4 January 2014 at 02:09:51 UTC, NoUseForAName wrote:
> This piece (recently seen on the Hacker News front page):
>
> http://rust-class.org/pages/using-rust-for-an-undergraduate-os-course.html
>
> .. includes a pretty damning assessment of D as "unsafe" 
> (compared to Rust) and generally doomed. I remember hearing 
> Walter Bright talking a lot about "safe code" during a D 
> presentation. Was that about a different kind of safety? Is the 
> author just wrong? Basically I want to hear the counterargument 
> (if there is one).

Disclaimer: I only have a cursory understanding of the subject.

With Rust, there are no dangling or null pointers. This means 
that if a pointer exists, it points to a valid object of the 
appropriate type. When a pointer does not point to a valid object 
of the appropriate type, accessing the content at the pointer 
results in undefined behavior or an error in languages that allow 
it. Rust implements all of these pointer safety checks at compile 
time, so they do not incur a performance penalty. While `@safe` 
helps reduce this class of logic errors, it does not go so far as 
Rust -- you can still have null and dangling pointers, hence it 
is usually considered inferior with regards to safety. There was 
a SafeD[1] subset of D being worked on, but I'm not sure if it is 
active anymore.

As for D slowly dying, I would say it is not true. It has been 
growing by all measures lately. With projects like DUB and 
Derelict making progress, the ecosystem is more inviting to 
users. I think a lot of people have a bad taste in their mouth 
from D1 with Phobos/Tango. D exceeds Rust in some aspects, but my 
understanding is that Rust is a more safe language.

Anyhow, my analysis may be wrong, so I expect that someone may 
correct it.

Regards,
Kelet


More information about the Digitalmars-d mailing list