Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
238 posts
|
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? Thanks in advance Nacho
Nacho
Smalltalker apprentice.
Buenos Aires, Argentina.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
194 posts
|
Hi, But classes like integer are passed by value. I think it's similar to C#. I may be wrong, so better wait for another more competent reply:) Best, Mark 2014-09-25 21:14 GMT+03:00 nacho <[hidden email]>: Hi, ... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
2343 posts
|
In reply to this post by nacho
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. Esteban A. Maringolo |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
194 posts
|
> Only small integers are passed as value? What about Float, for example? |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
5677 posts
|
Floats are passed as values.
Objects that are passed as values should be immutable, as floats and integers. Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. On Sep 25, 2014, at 3:35 PM, Mark Rizun <[hidden email]> wrote:
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
2343 posts
|
In reply to this post by Mark Rizun
I forgot. Floats too.
And I think that's it. Esteban A. Maringolo 2014-09-25 15:35 GMT-03:00 Mark Rizun <[hidden email]>: >> > Only small integers are passed as value? >> >> Yes. >> >> It has to do with the object headers, SmallIntegers are embedded in the >> OH. > > > What about Float, for example? > |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
5159 posts
|
In reply to this post by nacho
> Hi, > In PBE says that ordinary objects' ivars are passed by references and small > integers are passed by value. Strange I do not remember having written that. Especially because in Smalltalk this has no real interest. > Is there a way to know if a class is passed by reference or by value? In Smalltalk consider that everything is an object and that you pass a reference to the object. > Only small integers are passed as value? > Thanks in advance > Nacho > > > > > > ----- > Nacho > Smalltalker apprentice. > Buenos Aires, Argentina. > -- > View this message in context: http://forum.world.st/Passed-by-references-and-by-value-tp4780289.html > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. > > ... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
238 posts
|
This post was updated on Sep 25, 2014; 7:56pm.
"
Well you also wrote that :p "Deep in the implementation of Smalltalk, there are three different kinds of objects. There are (1) ordinary objects with instance variables that are passed by references, there are (2) small integers that are passed by value, and there are (3) indexable objects like arrays that hold a contiguous portion of memory. The beauty of Smalltalk is that you normally don’t need to care about the differences between these three kinds of object." > Is there a way to know if a class is passed by reference or by value? In Smalltalk consider that everything is an object and that you pass a reference to the object. > Only small integers are passed as value? > Thanks in advance > Nacho > > > > > > ----- > Nacho > Smalltalker apprentice. > Buenos Aires, Argentina. > -- > View this message in context: http://forum.world.st/Passed-by-references-and-by-value-tp4780289.html > Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com. > >
Nacho
Smalltalker apprentice.
Buenos Aires, Argentina.
|
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
1053 posts
|
Depending on the VM you use, different objects are passed by values. Currently -> only smallintegers on Spur 32 bits VM -> smallintegers and characters on Spur 64 bits VM -> smallintegers, characters and smallfloat But as Stef said it does not really matter in smalltalk. 2014-09-25 21:55 GMT+02:00 nacho <[hidden email]>: " ... [show rest of quote] |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
7582 posts
|
On 26 Sep 2014, at 08:07, Clément Bera <[hidden email]> wrote: > Depending on the VM you use, different objects are passed by values. > > Currently -> only smallintegers > on Spur 32 bits VM -> smallintegers and characters > on Spur 64 bits VM -> smallintegers, characters and smallfloat > > But as Stef said it does not really matter in smalltalk. > Yes, even for these cases you pass the *reference*, only that the reference happens to encode the value. Marcus |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
7582 posts
|
In reply to this post by Esteban A. Maringolo
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. > object, for small-integers the reference *is* the integer value. This means that there is no header for the integers. Marcus |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
1774 posts
|
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 ... [show rest of quote] ... [show rest of quote] 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 |
Loading... |
Reply to author |
Edit post |
Move post |
Delete this post |
Delete this post and replies |
Change post date |
Print post |
Permalink |
Raw mail |
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
5677 posts
|
In reply to this post by stepharo
Indeed, one should not care about copy by value / reference in Pharo.
Alexandre
--
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;: Alexandre Bergel http://www.bergel.eu ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;. On Sep 25, 2014, at 4:52 PM, stepharo <[hidden email]> wrote: Hi, ... [show rest of quote] |
Free forum by Nabble | Edit this page |