News for hackers. Stuff that matters.
Re:Would Rust Secure Curl? by jcranmer on Saturday January 16, 2021 @05:44PM (#25806245)
One of the things the author neglects is the ease of use of newtypes in Rust. This can actually alleviate a lot of parsing issues, by making it impossible to use stuff without parsing.

An example of where I've recently done something like this is my sparse linear algebra code. I have distinct types for column and row vectors for a matrix, so that if I want to right-multiply A with a vector, the input has to be a column vector and the output has to be a row vector. Similarly, if I want to left-multiply A with a vector, the input has to be a row vector and the output has to be a column vector.

Re:Would Rust Secure Curl? by p-squared on Saturday January 16, 2021 @10:02PM (#25807680)
Maybe Rust makes newtypes _easy_, but certainly C supports similar idioms by way of wrapping data in a unique struct.
Re:Would Rust Secure Curl? by steveklabnik on Sunday January 17, 2021 @12:57AM (#25808536)
The only significant difference is that you have to give the inner value a name in C, but you don't in Rust. It's a pretty marginal advantage.