Re: [Siop-development] Send by reference or by value?
Status: Pre-Alpha
Brought to you by:
slobberchops
From: Rapheal K. <ra...@ma...> - 2006-06-19 20:32:32
|
> > Question for folks... should the default mode of returning/sending > > values from method calls be by reference or by value for abstract types? > > Speaking from a ruby standpoint, I think by-reference would be easiest > and least surprising. In ruby, simple objects like integers are > (conceptually) passed by reference...but they are immutable objects, so > the effect is as if you had passed them by value. > > Speaking from an agile standpoint, I would be inclined to support only > by-reference until a case came up that made it unworkable. At that > point, a by_value wrapper would (hopefully) solve it. > That was my thinking on it. Integers and floats, however, will be passed by value. There is sort of already a use case, and as this is geared toward being compatible, it makes sense to support code where it requires an explicit certain type rather than just an interface. This will certainly be the case for things like Java and it is already the case for the Python class structure, where the inheritence parameters require an actual tuple object. That's why in my example I use the Python tuple class to construct a tuple rather than just passing in a Ruby list which I would have definitely preferred to have done. But you are right, I am not going to rush it. I think the next "Level" of SIOP should deal with these data typing/casting issues. |