On 2009-10-13 11:39:21 -0400, Sean Kelly <[email protected]> said:
I disagree about poor performance though. With unique references or
move semantics, a copy of even complex data isn't necessary to ensure
that a message is passed safely.
Yeah, but for unique reference to be usable you need lent semantics,
otherwise you can't make sure you're the unique holder once you call a
function to do something with your unique object.
Anything that use the reference could be storing it elsewhere:
unique!Object o = new Object;
o.doSomething();
How in the example above can I enforce that doSomething() won't escape
the 'o' reference elsewhere? 'doSomething' could be made 'pure', but
that trick will only work for one-argument functions (in the case
above, the argument is the implicit 'this') because otherwise a pure
function could leak the reference through another argument.
--
Michel Fortin
[email protected]
http://michelf.com/