3 ms·
> Rust can solve it identically to C++ by side stepping the borrow checker Doing that is prohibitively expensive in this particular case. It would require patc
by Const-me 5y ago
> Rust can solve it identically to C++ by side stepping the borrow checker
Doing that is prohibitively expensive in this particular case. It would require patching a large third-party library who uses Arc for the API: https://docs.rs/rune/latest/rune/struct.Vm.html#method.new https://docs.rs/rune/latest/rune/struct.Vm.html#method.new
And the reason that library uses Arc in the API is unique to Rust.
- dagmx 5y agoYou're talking about the specifics of this library. As you said in your original comment, that would apply to any C++ library using shared_ptr too across the API boundary. A different non-GC language wouldn't change things, because you'd have the exact same trade off if the same decision was made. The only major difference is that Rust pushes you to Arc but C++ doesn't push you to a shared_ptr.