Maybe I've not been clear, but what I'm most interested in, is to know whether an object would be passed by value, being a copy of the original, when specified. I thought it was NEVER, but Chris - with all respect - says this is a rumour?
See where the rumour comes from (for example):
http://codeverge.com/sybase.powerbuilder.general/pass-by-reference-vs-java-pass-by/1017088
or even from the pb help:
From the help of pb 2019, I find the information confusing and guess I'll just have to do a test app passing huge objects and see if memory is affected when passing an object by value, vs. passing readlonly and by ref.
Thanks you all for answering.
When you pass an object to a function or event, the object must exist when you refer to its properties and functions. If you call the function but the object has been destroyed, you get the execution error for a null object reference. This is true whether you pass by reference, by value, or read-only.
To illustrate, suppose you have a window with a SingleLineEdit. If you post a function in the window's Close event and pass the SingleLineEdit, the object does not exist when the function executes. To use information from the SingleLineEdit, you must pass the information itself, such as the object's text, rather than the object. When passing an object, you never get another copy of the object. By reference and by value affect the object reference, not the object itself.
Objects passed by value
When you pass an object by value, you pass a copy of the reference to the object. That reference is still pointing to the original object. If you change properties of the object, you are changing the original object. However, you can change the value of the variable so that it points to another object without affecting the original variable.
Objects passed by reference
When you pass an object by reference, you pass a pointer to the original reference to the object. Again, if you change properties of the object, you are changing the original object. You can change the value of the variable that was passed, but the result is different -- the original reference now points to the new object.
Objects passed as read-only
When you pass an object as read-only, you get a copy of the reference to the object. You cannot change the reference to point to a new object (because read-only is equivalent to a CONSTANT declaration), but you can change properties of the object.