News for hackers. Stuff that matters.
Re:Better C – A subset of D Programming Language by exiled13 on Tuesday April 28, 2020 @01:27PM (#23009408)
D's borrow checker fails in comparison to Rust's. It serves very little purpose and provides almost no guarantees. These issues have been brought up multiple times but they are brushed aside with ignorant responses like "I've been told my entire career what I'm doing will fail but I continue to do it anyways".
Re:Better C – A subset of D Programming Language by WalterBright on Tuesday April 28, 2020 @03:57PM (#23011162)
Yes, you do create accounts to follow D around and complain about it.
Re:Better C – A subset of D Programming Language by throwaway17_17 on Tuesday April 28, 2020 @05:23PM (#23012257)
What is the difference between the two?
Re:Better C – A subset of D Programming Language by exiled13 on Tuesday April 28, 2020 @06:30PM (#23012920)
Rust was designed from the ground up and every feature is implemented and designed to work with its borrow checker. So it is able to provide a definitive guarantee that memory isn't free'd or used after it is free'd. The only exception is in "unsafe" code, where you can break the borrow checker. But this limits where you have to worry about potential bugs.

In D, the ""borrow checker"" is being tacked on as an after thought, in an attempt to copy Rust. This means that it doesn't play nice with existing features and makes it difficult if not impossible to guarantee that memory isn't leaked or used after it was free'd. For example with exceptions. The checker doesn't check for exceptions and if memory is free'd correctly if an exception is thrown. This isn't a problem in Rust because it doesn't have exceptions so it doesn't have to worry about checking them so it can maintain its strong guarantee.

Re:Better C – A subset of D Programming Language by cesarb on Tuesday April 28, 2020 @08:05PM (#23013696)
> This isn't a problem in Rust because it doesn't have exceptions

Rust does have something similar to exceptions when compiled with "panic=unwind" (the default). It uses the same mechanism as C++ exceptions to unwind the stack (while calling all the necessary destructors), can be caught (std::panic::catch_unwind) and rethrown (std::panic::resume_unwind), and has some of the same concerns as C++ about "exception safety" (mostly within unsafe code - the programmer has to take care to leave the objects in a safe state when it can unwind).

Re:Better C – A subset of D Programming Language by exiled13 on Tuesday April 28, 2020 @10:31PM (#23014626)
I didn't know that used something akin to exceptions. Still panics aren't as common as exceptions (in D), and still only have to worry about unsafe code (for the most part).
Re:Better C – A subset of D Programming Language by WalterBright on Wednesday April 29, 2020 @12:35AM (#23015405)
D's version of Ownership/Borrowing adheres to the notion:

"only one mutable reference to a mutable object OR many const references to an object"

and that's where the similarity to Rust begins and ends. The realization of that principle is quite different.

Re:Better C – A subset of D Programming Language by exiled13 on Wednesday April 29, 2020 @06:42PM (#23025420)
Rust guarantees memory safety, or are you saying D isn't similar in that regard as well? If that's what you are saying, then I agree completely. D's ownership/borrowing does not provide memory safety, and that makes it pretty much useless.

There's really no point discussing this with you any further. You don't contribute anything to the discussion. That's just PR babble, and provides zero information and doesn't even deny the fact that exceptions break memory safety with D's borrow checker (you know it that's why you don't deny it like a "good" PR person).