246
submitted 7 months ago* (last edited 7 months ago) by arendjr@programming.dev to c/rust@programming.dev

Slide with text: “Rust teams at Google are as productive as ones using Go, and more than twice as productive as teams using C++.”

In small print it says the data is collected over 2022 and 2023.

you are viewing a single comment's thread
view the rest of the comments
[-] orclev@lemmy.world 3 points 7 months ago

It also massively helps with productivity

Absolutely! Types are as much about providing the programmer with information as they are the compiler. A well typed and designed API conveys so much useful information. It's why it's mildly infuriating when I see functions that look like something from C where you'll see like:

pub fn draw_circle(x: i8, y: i8, red: u8, green, u8, blue: u8, r: u8) -> bool {

rather than a better strongly typed version like:

type Point = Vec2<i8>;
type Color = Vec3<u8>;
type Radius = NonZero<u8>;
pub fn draw_circle(point: Point, color: Color, r: Radius) -> Result<()> {

Similarly I think the ability to use an any or dynamic escape hatch is quite useful, even if it should be used very sparingly.

I disagree with this, I don't think those are ever necessary assuming a powerful enough type system. Function arguments should always have a defined type, even if it's using dynamic dispatch. If you just want to not have to specify the type on a local, let bindings where you don't explicitly define the type are fine, but even in that case it still has a type, you're just letting the compiler derive it for you (and if it can't it will error).

this post was submitted on 28 Mar 2024
246 points (94.2% liked)

Rust

5981 readers
29 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS