Return by reference and pass by reference working with objects. Closures might present problems, however

This commit is contained in:
Nathan Braswell
2015-07-15 00:53:53 -04:00
parent 0ee44e829f
commit 06f36f2a87
12 changed files with 79 additions and 67 deletions

View File

@@ -52,14 +52,11 @@ obj string (Object) {
data.destruct()
}
fun operator[](index: int): char { return data[index]; }
fun operator[](index: int): ref char { return data[index]; }
fun slice(first: int, second: int): string {
var new.construct(data.slice(first,second)): string
return new
}
fun operator[]=(index: int, toSet: char) {
data[index] = toSet
}
fun set(index: int, toSet: char) {
data.set(index, toSet)
}