One other question:
(2) "alt" behaves much as a function call with alias parameters. To see why this is true, consider this code:
...
The solution is to treat "s" the same as any other alias; in particular, it must temporarily render "x" inaccessible for the duration of the "alt" statement. We also have to mandate that lvalues used in the expression position of an "alt" statement are unique, so that rendering them inaccessible really does make it impossible to affect the lifetime of their subparts (IOW, in this example, we have to make sure there's no other way to get to the contents of "x", i.e. "s").
Is that enough? I mean, consider this variant on your alt() example, where the value "s" extracted during the alt() is stored into a variable "y":
var x = some("foo");
var y = "bar";
alt (x) {
    case (some(?s)) {
        y = s; // save s
    }
}
x = none;
log y; // crash?
Would this crash? If not, why not? I guess it ultimately depends on what kind of ref-counting scheme is in place for strings (which I presume are stored in the heap, despite their value semantics).


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

Reply via email to