On Thursday, 26 May 2016 at 16:11:22 UTC, Andrei Alexandrescu wrote:
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


Interesting! I few noob questions first:

* Would it support implicit sharing (copy-on-write)? What about sub-strings?

* Will concatenations be fast?

* Would this have value for compile time string operations, mixin's, etc.?


RFC: what primitives should RCStr have?

String may have a few that are worth supporting: http://doc.qt.io/qt-5/qstring.html

Bastiaan.

Reply via email to