News for hackers. Stuff that matters.
Re:Why I love Rust for tokenising and parsing by sophacles on Friday November 08, 2024 @12:21PM (#42088570)
> Rust is designed with the philosophy of zero-cost abstractions. (I don’t like the name, because the cost is never zero, but it is what it is.)

So when the generated asm is the same between the abstraction and the non-abstraction version, wheres the cost?

Re:Why I love Rust for tokenising and parsing by steveklabnik on Friday November 08, 2024 @12:38PM (#42088741)
The point is that different people have different understandings of "cost." You're correct that that kind of cost is what "zero cost abstractions" means, but there are other costs, like "how long did it take to write the code," that people think about.
Re:Why I love Rust for tokenising and parsing by samatman on Friday November 08, 2024 @01:09PM (#42089045)
Cognitive cost is the most important cost to minimize.

A Rust project's cognitive cost budget comes out of what's left over after the language is done spending. This is true of any language, but many language designers do not discount cognitive costs to zero, which, with the "zero cost abstraction" slogan, Rust explicitly does.

Re:Why I love Rust for tokenising and parsing by klodolph on Sunday November 10, 2024 @10:53PM (#42104479)
> So when the generated asm is the same between the abstraction and the non-abstraction version, wheres the cost?

The generated asm isn’t the same.

There’s also a presupposition here that you know what the non-abstracted version would look like. If you don’t know what the non-abstracted version looks like, you can’t do a comparison.