L
Laura Stern
Guest
Re bdeavon's comment: There are some very *unusual* gotchas that arise when using BY-REFERENCE data and sending it into an OO class where the member data is declared REFERENCE-ONLY (as we normally do in our business logic layer). The member data in the OO class will now become a reference to the original instance of data that was passed in. If you then call some other instance methods of the class, the reference will remain in place. But when the flow-of-control finally *exits* from the original method (the one that received the BY-REFERENCE data) then the OO class will somehow "un-reference" that static data. Any subsequent call to the class will fail if it tries to access the same REFERENCE-ONLY member data (without supplying it once again as a parameter). There's nothing strange about that. The data is not copied. That's the whole point. Once we return from the method, we can also return from the caller, where the data actually lives. So of course, we can't reference the data any more if we call the method again (without supplying it once again as a parameter). The data could be gone. Of course, maybe the caller hasn't returned. Maybe the caller is still there and calls the method again. But the AVM doesn't know that, and I don't see why it should. Just pass in the same TT again. If you want the data to be there all the time once the call is made, then the data needs to be copied. That makes it "sticky"!
Continue reading...
Continue reading...