RE: pass by reference Karl
- Posted by kbochert at ix.netcom.com Feb 12, 2002
- 481 views
-------Phoenix-Boundary-07081998- Hi Bernie Ryan, you wrote on 2/12/02 1:20:32 PM: > >Karl: > What happens when a user does slicing, append, prepend > on the sequence that is passed. Don't forget that > sequences are dynamic and are reallocated dynamically. >Bernie > Thanks for pointing that out -- I had overlooked it totally. The good news is that I have now managed to correct the slicing case: procedure foo (sequence s) s = s[3..] end procedure sequence t = "Hello" foo (!!t) ?t -- => "llo" Time and again I run into these issues that seem to be killers, only to discover that the code to do them seems to be already there. I think Rob did NOT choose pass-by-value because it was the easy choice for implementation. My motivation for adding pass-by-value is to allow class methods to be passed a 'this reference' which refers to the instance to be modified. My original implementation accomplishes this nicely because no class method ever changes the structure of the instance. Given the ease of handling slices, I suspect that all cases could be handled, but the risk of deep problems grows, so I am somewhat reluctant to proceed. Thanks for the bug find Karl -------Phoenix-Boundary-07081998---