[Siop-development] Send by reference or by value?
Status: Pre-Alpha
Brought to you by:
slobberchops
From: Rapheal K. <ra...@ma...> - 2006-06-18 00:05:12
|
Question for folks... should the default mode of returning/sending values from method calls be by reference or by value for abstract types? By reference would make for better network performance and would be closer to the way languages actually function, whereas by value would probably be better for compatibility. There is also a question of consistency. Scalar values such as floats, integers and booleans always get sent by value by default. So, if a function returns a boolean, SIOP will return to the client a boolean value for that platform rather than a reference to a boolean object. However, as currently implemented non-scalar values, like lists and tuples are only returned by reference. You need to make a call to "fetch-value" in order to have the server send a copy of those objects back to the client. When it comes to parameters, it should be possible to use simple object wrappers to indicate to the bridge to send objects by reference or value explicitly. For example: remote_object.calculate_some_stuff( by_value( list_of_stuff ) ) The function above might return another list of values. Right now, this means that the client would receive a proxy that is a referenc to the list on the server. If we changed the policy to be by default by value it a) makes the network traffic go up by default and b) makes it more difficult to keep the results of an operation on the server. Also how would we indicate how to return references by value or by reference? Maybe we could have by-reference proxies and by-value proxies. So, to explicity get the above reference by-value, you could do: value_proxy( remote_object ).calculate_some_stuff( list_of_stuff ) All method calls to the value proxy could call a by value version of fetch-attribute and send-message instead of he default. Anybody care to venture thoughts? Does any of this make sense? - Rafe |