std.experimental.collections.rcstring and its integration in Phobos

Jon Degenhardt noreply at noreply.com
Wed Jul 18 03:40:08 UTC 2018


On Tuesday, 17 July 2018 at 15:21:30 UTC, Seb wrote:
> So we managed to revive the rcstring project and it's already a 
> PR for Phobos:
>
> https://github.com/dlang/phobos/pull/6631 (still WIP though)
>
> The current approach in short:
>
> - uses the new @nogc, @safe and nothrow Array from the 
> collections library (check Eduardo's DConf18 talk)
> - uses reference counting
> - _no_ range by default (it needs an explicit `.by!{d,w,}char`) 
> (as in no auto-decoding by default)
>
> [snip]
>
> What do you think about this approach? Do you have a better 
> idea?

I don't know the goals/role rcstring is expected to play, 
especially wrt existing string/character facilities. Perhaps you 
could describe more?

Strings are central to many applications, so I'm wondering about 
things like whether rcstring is intended as a replacement for 
string that would be used by most new programs, and whether 
applications would use arrays and ranges of char together with 
rcstring, or rcstring would be used for everything.

Perhaps its too early for these questions, and the current goal 
is simpler. For example, adding a meaningful collection class 
that is @nogc, @safe and ref-counted that be used as a proving 
ground for the newer memory management facilities being developed.

Such simpler goals would be quite reasonable. What's got me 
wondering about the larger questions are the comments about 
ranges and autodecoding. If rcstring is intended as a vehicle for 
general @nogc handling of character data and/or for reducing the 
impact of autodecoding, then it makes sense to consider from 
those perspectives.

--Jon


More information about the Digitalmars-d mailing list