Re: Passed by references and by value
Posted by
Henrik Sperre Johansen on
Sep 26, 2014; 12:19pm
URL: https://forum.world.st/Passed-by-references-and-by-value-tp4780289p4780510.html
On 26 Sep 2014, at 8:24 , Marcus Denker <
[hidden email]> wrote:
>
> On 25 Sep 2014, at 20:28, Esteban A. Maringolo <
[hidden email]> wrote:
>
>> 2014-09-25 15:14 GMT-03:00 nacho <
[hidden email]>:
>>> Hi,
>>> In PBE says that ordinary objects' ivars are passed by references and small
>>> integers are passed by value.
>>> Is there a way to know if a class is passed by reference or by value?
>>
>>> Only small integers are passed as value?
>>
>> Yes.
>>
>> It has to do with the object headers, SmallIntegers are embedded in the OH.
>>
>
> In the *reference*, not the header. The reference points to a header for a normal
> object, for small-integers the reference *is* the integer value. This means that
> there is no header for the integers.
>
> Marcus
So, a succinct phrasing indifferent to object format, using a relatively well-defined term, would be:
Only immediate objects are passed by value.
(Which means you have to explain immediate objects, as markus did)
Cheers,
Henry