Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

No. Rust has RAII so you can have retain on 'clone' operations and release on drops, just like the native Rc/Arc types do.

This is, incidentally, how the servo bindings to core-foundation work (I prefer those bindings where there is overlap).

Servo bindings: https://github.com/servo/core-foundation-rs

Other crates of interest on this topic: - https://crates.io/crates/objc - https://crates.io/crates/block



Someone has to manually type .clone() calls.


If you don't, the compiler tells you to, as per standard Rust semantics.


Automatic Reference Counting.

Writing by hand isn't the same.


Except that even Apple's ARC is not automatic - try passing the pointer to a GArray, or putting it on a malloc'ed linked list or any other data structure not implemented in Swift or ObjectiveC (provided that you compile objectiveC with the correct build flags).

The point is: you can't leak, you can't end up keeping a reference without incrementing the refcount and you don't events have to worry about any of the refcounting as long as the code you write is sound according to Rust rules.


Moving goalposts.

We are speaking about the normal development experience, not corner cases or unsafe code.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: