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 adde
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"
(*) Some
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,
sergio
I'm implementing an instance variable as an OrderedCollection, and am doing
something idiotic.
I have an Artist class.
An Artist can have many tracks:
tracks
^ tracks ifNil: [ self tracks: OrderedCollection new ]
tracks: anObject
tracks := anObject
Doing something like:
a := Artist n
because your #tracks: returns self, not the collection value
> On 24 Jul 2019, at 16:46, sergio ruiz wrote:
>
> I'm implementing an instance variable as an OrderedCollection, and am doing
> something idiotic.
>
> I have an Artist class.
>
> An Artist can have many tracks:
>
> tracks
> ^
Hi,
We have been hit in DrGeo by another regression in Pharo8 (it is not
present in DrGeo versions based on previous Pharo).
When loading a Sketch with accentuated Latin characters (same occurs
with Chinese but I have so far not enough information to assert it is
the same error) there is a ZnInva
Can you include the file that you are trying to load ?
Also, the stack trace is very short.
Are you sure XML parser is ready for Pharo 8 (i.e. are its tests green) ?
> On 24 Jul 2019, at 16:59, Hilaire wrote:
>
> Hi,
>
> We have been hit in DrGeo by another regression in Pharo8 (it is not
> p
Oh!
how about this:
tracks: anObject
tracks := anObject.
^ tracks
?
> On Jul 24, 2019, at 10:48 AM, Sven Van Caekenberghe wrote:
>
> because your #tracks: returns self, not the collection value
peace,
sergio
photographer, journalist, visionary
Public Key: http://bit.ly/
hmm…
maybe this is cleaner..
tracks
tracks ifNil: [ self tracks: OrderedCollection new ].
^ tracks
>
>
> because your #tracks: returns self, not the collection value
peace,
sergio
photographer, journalist, visionary
Public Key: http://bit.ly/29z9fG0
#BitMessage BM-NBas
You should change your #tracks method to
tracks
^tracks ifNil:[tracks:=OrderedCollection new]
or
tracks
tracks ifNil:[self initializeTracks]
^tracks
initializeTracks
tracks:=OrderedCollection new.
Then you don't have to worry about the implementation of #tracks: changing
in the fu
> On 24 Jul 2019, at 17:30, sergio ruiz wrote:
>
> hmm…
>
> maybe this is cleaner..
>
> tracks
> tracks ifNil: [ self tracks: OrderedCollection new ].
> ^ tracks
>
I write these methods as
tracks
^tracks ifNil: [ tracks := OrderedCollection new ].
- one line
Hi Sven,
Le 24/07/2019 à 17:05, Sven Van Caekenberghe a écrit :
> Can you include the file that you are trying to load ?
Attached.
It looks like issue come when saving the file. The UTF8 characters are
not saved properly. The unix file command was indicating it is an utf8
but Emacs shows it was
>
> tracks
> ^tracks ifNil: [ tracks := OrderedCollection new ].
>
> - one line
> - does not mix using accusers and not using accessors.
Okay, I totally get the subtlety now. I don’t even need an accessor.
Thanks!
peace,
sergio
photographer, journalist, visionary
Public Key: http:
I will add that I prefer the static model to tell the truth about its data
types. So, I prefer having an #initialize method which ensures the new
object is created in a self-consistent way and anyone looking at it in an
inspector will see useful and correct information. Leaving instance
variables u
I agree with that, but in some cases, like reading objects from an
ORM, you would be creating lots of instances of objects that are going
to be discarded right away.
This would put no stress on GC since it would happen in the "new"
space, but would consume more memory (although I never measured how
> On 24 Jul 2019, at 17:32, Hilaire wrote:
>
> Hi Sven,
>
> Le 24/07/2019 à 17:05, Sven Van Caekenberghe a écrit :
>> Can you include the file that you are trying to load ?
>
> Attached.
>
> It looks like issue come when saving the file. The UTF8 characters are
> not saved properly. The uni
--- Begin Message ---
A book that looks explores implementations like that and that always had
a place on my desk is this
https://www.amazon.ca/Smalltalk-Style-Suzanne-Skublics/dp/0131655493
I can highly recommend it.
Sebastian
On 2019-07-24 8:32 a.m., Marcus Denker wrote:
On 24 Jul 2019, a
Hi Seaside users,
We are organising a Smalltalk WebCamp day in the Yesplan offices in Ghent on
October 22nd.
The idea originated in the Seaside channel of the Pharo discord group. However,
it’s not supposed to be Seaside only. All Smalltalkers doing web development,
possibly involving other te
[...]
stream := WriteStream on: (String new: 4000).
DrGeoXml new
app: self app;
saveOn: stream.
[...]
DrGeoXml>>saveOn: stream
| doc writer root |
doc := XMLDocument new version: '1.0'.
writer := XMLWriter on: stream.
root := XMLElement named: #drgenius.
self writeFigureA
--- Begin Message ---
Hi Hilaire
I downloaded latest Dr Geo and took a quick look at how the files are saved.
It looks like the xml contents are not encoded (in UTF-8) but simply written to
a binary write stream, which means that when a WideString is written you should
consistently get a badly
That is correct, sk.
#writeStreamDo: is enough though, #utf8 is the default encoding
> On 24 Jul 2019, at 22:16, sk via Pharo-users
> wrote:
>
>
> From: sk
> Subject: Re: [Pharo-users] P7 regression
> Date: 24 July 2019 at 22:16:50 GMT+2
> To: Any question about pharo is welcome
>
>
> Hi
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 understandin
Comment 1.
You probably meant to write
tracks: aCollection
^tracks := aCollection
Comment 2.
This is a poor design. As it is, any object can replace the tracks of an
artist
with *anything*. And even without doing that, any object can add and
remove
items to an artist's tracks,
23 matches
Mail list logo