Escaping the Tyranny of the GC: std.rcstring, first blood

"Nordlöw" via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 24 13:08:40 PDT 2014


On Monday, 15 September 2014 at 02:26:19 UTC, Andrei Alexandrescu 
wrote:
> So, please fire away. I'd appreciate it if you used RCString in 
> lieu of string and note the differences. The closer we get to 
> parity in semantics, the better.

Further,

import std.container: Array;
import rcstring;

unittest
{
     Array!RCString x;
}

fails as

/home/per/opt/x86_64-unknown-linux-gnu/dmd/linux/bin64/src/phobos/std/conv.d(4010,17): 
Error: expression hasElaborateAssign!(RCXString!(immutable(char), 
23LU, realloc)) of type void does not have a boolean value
/home/per/opt/x86_64-unknown-linux-gnu/dmd/linux/bin64/src/phobos/std/conv.d(3970,31): 
Error: template instance 
std.conv.emplaceInitializer!(RCXString!(immutable(char), 23LU, 
realloc)) error instantiating
/home/per/opt/x86_64-unknown-linux-gnu/dmd/linux/bin64/src/phobos/std/conv.d(4064,18): 
        instantiated from here: emplaceImpl!(string)
/home/per/Work/justd/rcstring.d(428,16):        instantiated from 
here: emplace!(RCXString!(immutable(char), 23LU, realloc), string)
/home/per/Work/justd/rcstring.d(13,18):        instantiated from 
here: RCXString!(immutable(char), 23LU, realloc)
/home/per/opt/x86_64-unknown-linux-gnu/dmd/linux/bin64/src/phobos/std/algorithm.d(1577,16): 
Error: template instance 
std.traits.hasElaborateAssign!(RCXString!(immutable(char), 23LU, 
realloc)) error instantiating
/home/per/opt/x86_64-unknown-linux-gnu/dmd/linux/bin64/src/phobos/std/container/array.d(85,26): 
        instantiated from here: 
initializeAll!(RCXString!(immutable(char), 23LU, realloc)[])
t_rcstring_array.d(8,5):        instantiated from here: 
Array!(RCXString!(immutable(char), 23LU, realloc))
/home/per/opt/x86_64-unknown-linux-gnu/dmd/linux/bin64/src/phobos/std/container/array.d(276,24): 
Error: template instance 
std.algorithm.move!(RCXString!(immutable(char), 23LU, realloc)) 
error instantiating
t_rcstring_array.d(8,5):        instantiated from here: 
Array!(RCXString!(immutable(char), 23LU, realloc))
/home/per/opt/x86_64-unknown-linux-gnu/dmd/linux/bin64/src/phobos/std/conv.d(4064,18): 
Error: template instance 
std.conv.emplaceImpl!(RCXString!(immutable(char), 23LU, 
realloc)).emplaceImpl!(RCXString!(immutable(char), 23LU, 
realloc)) error instantiating
/home/per/opt/x86_64-unknown-linux-gnu/dmd/linux/bin64/src/phobos/std/container/array.d(186,20): 
        instantiated from here: 
emplace!(RCXString!(immutable(char), 23LU, realloc), 
RCXString!(immutable(char), 23LU, realloc))
/home/per/opt/x86_64-unknown-linux-gnu/dmd/linux/bin64/src/phobos/std/container/array.d(356,21): 
        instantiated from here: 
__ctor!(RCXString!(immutable(char), 23LU, realloc))
t_rcstring_array.d(8,5):        instantiated from here: 
Array!(RCXString!(immutable(char), 23LU, realloc))

Any clue what's missing in RCXString?


More information about the Digitalmars-d mailing list