Testing a draft of `.replaceRegexp`

Thanks @jordan !

Getting used to a new codebase is always a learning curve. I don’t think it is documented, and it probably should be since that would be a reasonable assumption. In SC Strings aren’t null terminated because they are defined as a type of array. So in C++ it would be more like std::vector<char> (which isn’t null terminated) than std::string (which is).


I also found that symbols are null terminated, which really confused me because they store their size as well,
but it is a uint8_t and doesn’t include the null terminator.

I just had a quick look and the uint8_t causes at least one bug…

// works, produces a file with 255 'a's
a = ('a'!255).reduce('++').asString.asSymbol
f = File("~/tmp/test.txt".standardizePath, "w")

// does not work, produces an empty file
a = ('a'!256).reduce('++').asString.asSymbol
f = File("~/tmp/test.txt".standardizePath, "w")

There are also a few other places this occurs, although most primitives call strlen on the char*.

Definitely off topic now, but I will make a gh issue.

1 Like