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.

Regards,
Alex.


2013/4/23 Felix S. Klock II <[email protected]>

> Alexander-
>
> What are you suggesting would be the semantics for a Shared -> Owned
> conversion?
>
> Just think about it in the the abstract for a moment: If X and Y are both
> sharing a reference to a @Pizza, and X decides it wants to hand the pizza
> to a customer who is expecting a ~Pizza, what is X supposed to do?  Block
> until Y relinquishes its hold on the pizza?  To my mind, X has no choice
> but to cook another pizza that looks just like the one it is shared with Y.
>
> (Now, Owned -> Shared conversion might actually make sense in the
> abstract; at that point I think we'd just be encountering implementation
> artifacts of the Rust language, rather than fundamental obstacles?)
>
> Cheers,
> -Felix
>
>
> On Tue Apr 23 15:36:25 2013, Alexander Stavonin wrote:
>
>> Hi all, I'm really confused. What's about Shared 2 Owned conversions?
>> This one looks ugly, nevertheless works:
>>
>> let a = @5;
>> let b = *a;
>> let c = ~b;
>> io::println(fmt!("%?, %?, %?", a, b, c));
>>
>> > @5, 5, ~5
>>
>> But what about arrays?
>>
>> let a = @[5];
>> let b = *a;
>> let c = ~b;
>>
>> > error: type @[<VI0>] cannot be dereferenced
>>
>> Is it true, that there is no any way for converting between different
>> boxes types without deep copying of objects?! I'm shocked %)
>>
>>
>> ______________________________**_________________
>> Rust-dev mailing list
>> [email protected]
>> https://mail.mozilla.org/**listinfo/rust-dev<https://mail.mozilla.org/listinfo/rust-dev>
>>
>
>
>
> --
> irc: pnkfelix on irc.mozilla.org
> email: {fklock, pnkfelix}@mozilla.org
>
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to