tjysdsg / tan

A programming language for fun

Home Page:https://tjysdsg.github.io/tan/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make string mutable

tjysdsg opened this issue · comments

Code like this doesn't work:

pub fn main() : int {
    var s = "string";
    s[0] = 'p';
    assert(s[0] == 'p');
    return 0;
}

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.