Re: [Pharo-users] [OrderedCollection] add a reference or a copy?

2019-07-24 Thread Richard O'Keefe
To a very good approximation, Smalltalk doesn't copy anything unless you ask it to. In this respect it's just like Java, Python, Ruby, ECMAScript, and most OO languages. C++ *does* like to copy things, but it is unusual. On Thu, 25 Jul 2019 at 00:46, sergio ruiz wrote: > I think my

Re: [Pharo-users] [OrderedCollection] add a reference or a copy?

2019-07-24 Thread sergio ruiz
Okay. This makes the entire universe make more sense. Thanks! > On Jul 24, 2019, at 9:30 AM, Esteban Maringolo wrote: > > Yes, it is the same. Everything is passed by "reference" (*). > And if you copy the collection you'll get two collections referencing > the same object. peace,

Re: [Pharo-users] [OrderedCollection] add a reference or a copy?

2019-07-24 Thread Esteban Maringolo
Yes, it is the same. Everything is passed by "reference" (*). And if you copy the collection you'll get two collections referencing the same object. E.g. | a c1 c2 | a := Object new. b := OrderedCollection with: a. b identityIncludes: a. "true" c := b copy. c identityIncludes: a. "true" (*)

[Pharo-users] [OrderedCollection] add a reference or a copy?

2019-07-24 Thread sergio ruiz
I think my understanding of OrderedCollections has been incorrect for a very long time. I have never had a situation where it mattered, but in modeling a current project, I think I have been approaching it incorrectly. Since I have been using Smalltalk, I assumed that a copy of an object is