(no subject)

Date: 2017-04-21 07:27 pm (UTC)
jducoeur: (Default)
From: [personal profile] jducoeur
you can pass a unique_ptr to another function, but in so doing yours is invalidated at run-time, maintaining the single-owner invariant

Ah, hang on -- this is invalidated at *runtime*? That doesn't surprise me, but it's a crucial difference: in Rust, it is invalidated at *compile* time -- if you pass an unshared ref to a function, any attempts to reference it after that function call result in a compile error. References are more a compile-time constraint than a runtime one, so that you get fast feedback with little runtime overhead.

That's the thing about building this ownership stuff deeply and fundamentally into the language: they're able to provide *really* strong, compile-time guarantees based on it. I'm not clear whether C++ has managed to achieve that yet...
(will be screened)
(will be screened if not validated)
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

Profile

jducoeur: (Default)
jducoeur

June 2025

S M T W T F S
12 34567
891011121314
15161718192021
22232425262728
2930     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags