Make string mutable
tjysdsg opened this issue · comments
Jiyang (Mark) Tang commented
Code like this doesn't work:
pub fn main() : int {
var s = "string";
s[0] = 'p';
assert(s[0] == 'p');
return 0;
}
Jiyang (Mark) Tang commented
After reconsidering the language design, I decided to make builtin str
immutable and be stored on stack. A container in std
will contain an implementation of a growable and mutable string.