On 24/09/2011 1:02 PM, [email protected] wrote:

This test tries to swap unique boxes containing resources, which is not
allowed.

Hi. I know I'm officially on break now but I did see this go past while checking on other things, and wanted to point out that (though it's counter-intuitive) I think this is not quite right. In particular, if you look at the comment in kind.rs you'll see that it says:

MOVE + NOSEND  =  "Shared": structures containing @, fixed to the local
                            task heap/pool; or ~ structures pointing to
                            pinned values.

That is, a ~ box containing pinned-kind lowers to shared-kind, not to pinned itself. This is to prevent it moving over channels (localizing it to the current heap) but not prevent swapping pointer-to-resource, which seems to be the only useful way to make a resource have indefinite extent (live as long as a data structure).

I realize that "~resource" doesn't "look shared" in an intuitive sense, but it's a bit of a corner case and I think it's the right rule; other rules involve having move/swap/copy discriminate by type constructor first ("is this a box? if so, look at content-kind, else look at total-kind") which feels clunkier.

I know It's even probably counter-intuitive overall that ~ is the "most capable" kind, and that @ is lower than ~, but that's how it seems to work out if you aim for minimal rules :)

It might make more sense if we renamed the kinds to their heaps: "exchange", "local", "pinned", or something like that? I'm pretty easy on that point.

-Graydon
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to