47 ms·
>> In the end either safety is either important, or it isn't. Choose accordingly. Not to disagree with your post but this comes across as very black-and-white.
by jstimpfle 4y ago
>> In the end either safety is either important, or it isn't. Choose accordingly.
Not to disagree with your post but this comes across as very black-and-white.
- dannymi 4y agoTo expand: There's a prioritized list of requirements in engineering. Use the right tool for the job. Rust has: (see https://hackmd.io/@rust-ctcft/r1plN4You#/5 https://hackmd.io/@rust-ctcft/r1plN4You#/5 ) 1. Safety If you don't need that at the first slot, then the biggest strength of Rust doesn't apply to your problem (and you would waste time having to track lifetime parameters more than necessary to solve your problem).
- estebank 4y agoThere's also another item in that list, and that is performance. As soon as you slightly relax that one, Rust does become massively easier. A well placed .clone() or Arc makes the rest of the code performant enough and easier to understand, which makes the equation of choosing Rust over other alternatives in spaces that aren't necessarily systems programming less problematic.
- ncmncm 4y agoArc is equivalent to std::shared_ptr, and so ought to be code smell in Rust. The .clone() would have been [=] in C++, which would have safely quieted the warning.
- pdimitar 4y agoBig problem in these discussions is what should be prioritized. To me, with the 20 years of experience I have in 8 programming languages, I'll always include safety. Especially having in mind that it's nearly zero-cost in terms of runtime performance. So to me not choosing safety is a strong sign that I don't want to work with the people who practice that.
- ncmncm 4y agoThe point missed everywhere is that Rust lacks key language features needed to capture essential semantics in libraries, that C++ provides. To code libraries I want to code, I cannot use Rust. Rust cannot express them. So, safety, good, fast enough, good, but insufficiently expressive? No, thank you.
- pdimitar 4y agoIt's probably missed everywhere because I at least have not seen anyone giving concrete info about which are these missing key language features. Want to elaborate on that? Quite curious.
- rmadriz 4y agocan you elaborate on those key missing language features ? You have commented multiple times about that, but haven't seen you giving any concrete example. I'm Genuinely curious.
- ncmncm 4y agoWhere to begin? Operator overloading. Programmed move semantics. Generics argument concepts. Look at the whole list of features C++ got since C++11, and subtract out the few of those Rust had or got.
- dannymi 4y agoI've done a toy matrix library with operator overloading in Rust a while ago. Could you be confusing it with Java? #[derive(Debug, PartialEq, Eq)] pub struct ColumnVector<F, const DIM: usize>([F; DIM]); impl<F: Field, const DIM: usize> Add<Self> for ColumnVector<F, DIM> { type Output = ColumnVector<F, DIM>; fn add(self, rhs: Self) -> Self::Output { Self::new(self.0.zip(rhs.0).map(|(a,b)| a + b)) } } Usage: let v = ColumnVector::new([1.0, 3.0, 4.0]); let w = ColumnVector::new([1.0, 0.0, 4.0]); assert_eq!(v + w, ColumnVector::new([2.0, 3.0, 8.0]));