Our Sister

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Thu May 26 09:11:22 PDT 2016


I've been working on RCStr (endearingly pronounced "Our Sister"), D's 
up-and-coming reference counted string type. The goals are:

* Reference counted, shouldn't leak if all instances destroyed; even if 
not, use the GC as a last-resort reclamation mechanism.

* Entirely @safe.

* Support UTF 100% by means of RCStr!char, RCStr!wchar etc. but also raw 
manipulation and custom encodings via RCStr!ubyte, RCStr!ushort etc.

* Support several views of the same string, e.g. given s of type 
RCStr!char, it can be iterated byte-wise, code point-wise, code 
unit-wise etc. by using s.by!ubyte, s.by!char, s.by!dchar etc.

* Support const and immutable qualifiers for the character type.

* Work well with const and immutable when they qualify the entire RCStr 
type.

* Fast: use the small string optimization and various other layout and 
algorithms to make it a good choice for high performance strings

RFC: what primitives should RCStr have?


Thanks,

Andrei


More information about the Digitalmars-d mailing list