Escaping the Tyranny of the GC: std.rcstring, first blood
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Mon Sep 15 12:54:19 PDT 2014
On 2014-09-15 16:45, Andrei Alexandrescu wrote:
> On 9/15/14, 2:50 AM, monarch_dodra wrote:
>> - Does not provide Forward range iteration that I can find. This makes
>> it unuseable for algorithms:
>> find (myRCString, "hello"); //Nope
>> Also, adding "save" to make it forward might not be a good idea, since
>> it would also mean it becomes an RA range (which it isn't).
>
> If we move forward with this type, traits will recognize it as
> isSomeString.
>
>> - Does not provide any way to (even "unsafely") extract a raw array.
>> Makes it difficult to interface with existing functions. It would also
>> be important for "RCString aware" functions to be properly optimized (eg
>> memchr for searching etc...)
>
> I think a @system unsafeSlice() property would be needed indeed.
>
>> - No way to "GC-dup" the RCString. giving "dup"/"idup" members on
>> RCstring, for when you really just need to revert to pure un-collected
>> GC.
>
> Nice. But then I'm thinking, wouldn't people think .dup produces another
> RCString?
Yes, most likely. How about "gcDup" or something like that.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list