Local t$="Hello"
DoSomething( t )
Assert t="Hello"
...currently, this code is guaranteed not to cause an exception since nothing can modify the string.
Yes this right. But two things:
1) Is this really really need?
2) If I really want i can change string in function DoSomething. Not so easy, but this is possible. So no guaranties.
And indexed access to string's elements is useful.
If Mark don't want do this, this don't meant that we can't do this.
Enjoy:
Local str$ = "Hello" Print str 'getting pointer to chars: Local p:Int Ptr = Int Ptr(Varptr(str)) Local pchar:Short Ptr = Short Ptr(p[0]) pchar :+ 6 'this offset depends on string's structure pchar[0]=Asc("H") pchar[1]=Asc("e") pchar[2]=Asc(" ") pchar[3]=Asc("h") pchar[4]=Asc("e") Print str