Category talk:LSL Types
The section on mutability seems wrong, or at least needs more explanation if it isn't. Vectors and Rotations clearly appear to be mutable:
vector v = <1,3,3>; v.x = 0;
Obviously, the following sequence has the same result:
vector v = <1,2,3>; v = <0,v.y,v.z>;
These might be operationally equivalent. But it is less than clear that they are operationally the same (at least naively, one would expect the two versions to have a different machine implementation, with the first perhaps more efficient).
Yeah, even more obviously, lists are mutable. The person must have meant "basic types" or something... Dale Innis 20:46, 26 April 2012 (PDT)
- You bring up a good point. The section is talking about a different type of mutability. What it is trying to say is that when a function is called the parameters are copies. You can manipulate and overwrite the parameters all you want and those changes will not be conveyed to the calling scope. So in that sense all variables are immutable. LSL may have pass by reference under the hood, but it does not enable mutability. In many languages you pass a list by reference to a sort function and that function sorts the list. The value of the list has changed as a result of calling the function. LSL does not have that capacity. In LSL anything you pass to a function will be unchanged by the function. Vectors & rotations are only sort of mutable (lists are not mutable at all), you can change their components. Coaching this in terms of mutability was a bad choice. Is there a better word for this? -- Strife (talk|contribs) 21:33, 26 April 2012 (PDT)