On Wednesday, 1 October 2014 at 17:13:38 UTC, Andrei Alexandrescu
wrote:
On 10/1/14, 8:48 AM, Oren Tirosh wrote:
Bingo. Have some way to mark the function return type as a
unique
pointer.
I'm skeptical about this approach (though clearly we need to
explore it for e.g. passing ownership of data across threads).
For strings and other "casual" objects I think we should focus
on GC/RC strategies. This is because people do things like:
auto s = setExtension(s1, s2);
and then attempt to use s as a regular variable (copy it etc).
Making s unique would make usage quite surprising and
cumbersome.
Sure? I already showed in an example how it is possible to chain
calls seamlessly that return unique objects. The users would only
notice it when they are trying to make a real copy (i.e. not
borrowing). Do you think this happens frequently enough to be of
concern?