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
> 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
> 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
> 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
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.
>
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
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