On 03/03/2014 05:54 PM, Patrick Walton wrote:
On 3/3/14 5:53 PM, Daniel Micay wrote:
On 03/03/14 08:19 PM, Steve Klabnik wrote:
Part of the issue with that statement is that you may or may not
program in this way. Yes, people choose certain subsets of C++ that
are more or less safe, but the language can't help you with that.
You can choose to write unsafe code in Rust too.
You have to write the *unsafe* keyword to do so.
It's clear that we need someone fully competent in C++ to
code any comparisons. In C++, one is only ever motivated to
("unsafely") extract the raw pointer from a smart pointer when
only a raw pointer will do. This is exactly as likely to happen
in Rust as in C++, and in exactly the same places. Where it is
needed, Rust offers no safer alternative.
If this were the kind of safety that motivated Rust development,
C++ users would be fully justified in declaring the project and
the language a big waste of time, and never looking at it again.
That response seems worth some effort to avoid evoking. No amount
of explanation why the reader should not abandon us in disgust
can help when that reader has already left.
Any C++ examples offered should exhibit unsafe practices that
readers encounter in real code, and that result in real bugs.
Such examples are easy to find. We don't need to invent fakes.
Most of the value of the function prototypes that C89 adopted
from the C++ of the day was time not spent manually checking
all the call sites whenever arguments changed. (With C++,
they gave us overloading, too.) C programs can still declare
functions with no unchecked arguments, but now we have every
reason not to, and nobody does. Useful safety means less that
needs to be paid attention to.
(Arguably, BTW, the keyword should be "safe", because you are
asserting to the compiler that it should consider what is being
done there to be safe, despite any misgivings it may have, and
challenging the reader to contradict it. But that's a bridge
already burnt.)
Nathan Myers
n...@cantrip.org
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev