Re: [Pharo-users] Thread-safe initialization of class state (was Re: Threads safety in Pharo)

2017-08-11 Thread Tim Mackinnon
alid pattern. > >> On Fri, Aug 11, 2017 at 10:39 AM, monty wrote: >> > Sent: Friday, August 11, 2017 at 6:36 AM >> > From: "Denis Kudriashov" >> > To: "Any question about pharo is welcome" >> > Subject: Re: [Pharo-users] Thread-sa

Re: [Pharo-users] Thread-safe initialization of class state (was Re: Threads safety in Pharo)

2017-08-11 Thread Gabriel Cotelli
> Subject: Re: [Pharo-users] Thread-safe initialization of class state > (was Re: Threads safety in Pharo) > > > > What package you explore? I not find fileTypes method in Pharo 7. > > Like I said, it's a hypothetical example. But I'm sure you could find > similar example

Re: [Pharo-users] Thread-safe initialization of class state (was Re: Threads safety in Pharo)

2017-08-11 Thread monty
> Sent: Friday, August 11, 2017 at 6:36 AM > From: "Denis Kudriashov" > To: "Any question about pharo is welcome" > Subject: Re: [Pharo-users] Thread-safe initialization of class state (was Re: > Threads safety in Pharo) > > What package you explor

Re: [Pharo-users] Thread-safe initialization of class state (was Re: Threads safety in Pharo)

2017-08-11 Thread monty
> Sent: Friday, August 11, 2017 at 5:51 AM > From: "Tim Mackinnon" > To: "Any question about pharo is welcome" > Subject: Re: [Pharo-users] Thread-safe initialization of class state (was Re: > Threads safety in Pharo) > > Interesting, your example was

Re: [Pharo-users] Thread-safe initialization of class state (was Re: Threads safety in Pharo)

2017-08-11 Thread Denis Kudriashov
What package you explore? I not find fileTypes method in Pharo 7. 2017-08-11 8:53 GMT+02:00 monty : > Here's a hypothetical broken class method that does lazy initialization of > a class inst var: > > fileTypes > fileTypes ifNil: [ > fileTypes := Dictionary new. >

Re: [Pharo-users] Thread-safe initialization of class state (was Re: Threads safety in Pharo)

2017-08-11 Thread Tim Mackinnon
Interesting, your example was subtle enough that I had to read it a few times to understand the issue. (I was caught up on the ifNil and not the contents). Actually, thinking about it - isn't the real issue the #ifNil - you want an atomic version. It strikes me you could wrap the whole concept

[Pharo-users] Thread-safe initialization of class state (was Re: Threads safety in Pharo)

2017-08-10 Thread monty
Here's a hypothetical broken class method that does lazy initialization of a class inst var: fileTypes fileTypes ifNil: [ fileTypes := Dictionary new. fileTypes at: 'txt' put: 'Text File'; at: 'html' put: 'Web