On Friday, 2 May 2014 at 18:32:13 UTC, Dylan Knutson wrote:
Correct me if I'm wrong here, but this seems really similar to
how Rust does owned pointers and move semantics. Or is there a
large conceptual difference between the two that I'm missing?
Yes, there are some parallels, although there's no "merging of
islands" in Rust, AFAIK.
I believe that the issues that people are bringing up with bad
interaction with UFCS, and losing isolated data after passing
it to a function, are managed in Rust with the notion of a
borrowed pointers. Perhaps something analogous to this could
accompany the `isolated` idea?
This will definitely need more thought. I also don't think that
UFCS is special; methods should probably be just treated like
free functions with a hidden parameter, just as they are for pure.
Purity might be one part of the solution here: pure functions can
for example take isolated arguments without consuming them, iff
their parameters and the isolated variable have "incompatible"
types in that it mustn't be possible to store a reference to one
in the other. (The same is true for scoped variables: they cannot
escape their scope, even if the pure function's params are not
marked as scope.)
Another option are scope/in parameters.
All of this purity, isolated, scope, uniqueness business is
closely intertwined... there just needs to be an elegant way to
make it all fit together.