Reply to post: Re: "Reference Counted"

The Rust Foundation gets ready to Rumbul (we're sure new CEO has never, ever heard that joke before)

Anonymous Coward
Anonymous Coward

Re: "Reference Counted"

> Better?

Not really.

> Rust runtime will detect problem and stop execution.

You seem to believe that this Rust run-time detection - of what exactly, I don't know, it's not clear - is cost-free. It's not.

If reference counting is involved, there is a cost penalty associated with it: the reference counter itself must be incremented / decremented atomically, inside a critical section. That can be done either (a) with a mutex lock and unlock or (b) with a cas (compare-and-swap).

Neither are cost free. And contrary to popular belief, neither method is lock-free.

Yet again, this all comes down to: so-called programmers who can't deal with pointers and dynamic memory allocation.

This is what happens when you don't learn C. Instead of keeping track of one's pointers and memory allocation, one relies on the machine to do it. It can do it, but it's always a giant hammer.

Instead of putting in the effort to determine where the double-free occurs, and correcting it, make everything a reference-counted pointer.

In final analysis, it's just a transfer of incompetence. The incompetence of the programmer is transferred to the incompetence of the Rust runtime, which will make everything reference-counted, whether it's needed or not.

Apparently, that's a valid approach.

The programmer still has no clue why their program doesn't work correctly in C (or C++). They just notice that "if I write it in Rust it doesn't crash, so I'ma gonna do that."

Cargo Cult Programming.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon