On Friday, 27 May 2016 at 21:25:50 UTC, Andrei Alexandrescu wrote:
On 05/27/2016 05:02 PM, Era Scarecrow wrote:
With the current state of things, I'll just take your word
on it.
Reasoning is simple - yes we could safely convert to
const(char)[] but that means effectively all refcounting is
lost for that string. So we can convert but in an explicit
manner, e.g. str.toGCThisWillCompletelySuckMan. -- Andrei
We could have:
const(char)[] s = rcstr.stealSlice;
Which is null* if the refcount is > 1. rcstr would then be empty
on success. In fact if with the RC DIP we guarantee the memory
doesn't escape, stealSlice could return string.
*Or better, return an Option.