On Monday, 15 September 2014 at 13:13:34 UTC, Jakob Ovrum wrote:

If you are suggesting we somehow make this work so it can be a drop-in replacement for `string`:

Yes, you must be able to get a RCString from one thread to the next.


I don't think that should be implicitly supported.


Well, it should be at least supported in phobos.

How is another matter.


Maybe the right solution involves integration with std.typecons.Unique. Passing an instance of Unique!T to another thread is something std.concurrency should support, and RCString could be given a method that returns Unique!RCString if the reference count is 1 and errors otherwise. Unique's current implementation would have to be overhauled to carry its payload in-situ instead of on the GC heap like it currently does, but that's something we should do regardless.

Sounds good.

Reply via email to