Return by reference and pass by reference working with objects. Closures might present problems, however
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user