On 13-04-23 06:54 AM, Alexander Stavonin wrote:
Felix, thank you for response. I agree with you about difference between
Shared and Owned memory models. It's two different heaps
with different management rules. It's clean. Now, lets go
to practical things such as next one. We have two Tasks with some
computations. For passing values between the tasks we have use Owned box
but, internally, we usually are using Shared boxes. In this case, for
all tasks we have to write converters from Shared to Owned and
from Owned to Shared boxes. It's really big source code overhead from
nothing.

If you have constructive suggestions about how to generally convert a possibly-cyclic graph of possibly-multiply-referenced substructures into a proper tree without incurring a deep copy, we'd all be interested to hear it. Otherwise this is behaving as expected (and documented). We're all aware that the separation of heaps incurs some costs along with its benefits.

I'm sorry if it comes as a surprise but it's the cost we carry in order to gain the many, many benefits of linearity in owned types. As far as I know one can't really have it both ways. Other languages don't get out of this for free either. They either incur the costs of pervasive memory contention, locking and concurrent garbage collection, or they copy _everything_ (like erlang) when transmitting.

Non-constructive criticism like "big source code overhead from nothing", "shocked", "ugly" and such are not helpful (in addition to drifting outside the participation guidelines for the project[1]).

-Graydon

[1] https://github.com/mozilla/rust/wiki/Note-development-policy#conduct
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to