Relaxing the definition of isSomeString and isNarrowString

via Digitalmars-d digitalmars-d at puremagic.com
Sun Aug 24 05:49:29 PDT 2014


On Sunday, 24 August 2014 at 12:24:03 UTC, Andrei Alexandrescu 
wrote:
> To that end I'm working on RCString, an industrial-strength 
> string type that's much like string, just reference counted and 
> with configurable allocation. It's safe, too - user code cannot 
> casually extract references to string internals. By default 
> allocation would use GC's primitives; one thing I learned to 
> appreciate about our GC is its ability to free memory 
> explicitly, which means RCString will free memory 
> deterministically most of the time, yet if you leak some (e.g. 
> by having RCString class members) the GC will pick up the 
> litter. I think reference counting backed up by a GC that lifts 
> litter and cycles and is a modern, emergent pattern that D 
> could use to great effect.

Any reason why this is restricted to strings? I.e., is there 
something special about strings (apart from auto-decoding) that 
doesn't apply to arrays in general? If not, wouldn't an RCArray 
be a better idea?


More information about the Digitalmars-d mailing list