Done

https://pharo.fogbugz.com/f/cases/15007/Add-comment-on-ProcessLocalSlot-for-its-drawbacks

El Fri Feb 27 2015 at 11:31:55 AM, Guillermo Polito <
guillermopol...@gmail.com> escribió:

> Haha, I didn't know that. I'll add that in the class comment.
>
> El Fri Feb 27 2015 at 11:23:59 AM, Alejandro Infante <
> alejandroinfant...@gmail.com> escribió:
>
> First of all, the things that you are doing with slots are just amazing. I
>> never thought that there were so many cool stuff that could be done with
>> them.
>>
>> Now, two things to point out about the ProcessLocalSlot that probably not
>> all know.
>>
>> 1) The value is stored weakly, an example of this would be:
>> obj := MyClass new.
>> obj local: Object new.
>> obj local. “anObject” <—— Now we see the object
>> Smalltalk garbageCollect.
>> obj local. “nil” <—— Now we don’t
>>
>> 2) This variable are stored in a WeakArray in the Process, so massive use
>> of them will make the array in the processes start growing a lot and often.
>> Use them wisely :)
>>
>> Again, really cool stuff.
>> Thanks Guille!!!
>>
>> Cheers,
>> Alejandro
>>
>> On Feb 26, 2015, at 10:32 PM, Tudor Girba <tu...@tudorgirba.com> wrote:
>>
>> Very very nice!
>>
>> This is really cool.
>>
>> Doru
>>
>> On Thu, Feb 26, 2015 at 7:01 PM, Sven Van Caekenberghe <s...@stfx.eu>
>> wrote:
>>
>>> *Very* nice !
>>>
>>> > On 26 Feb 2015, at 18:55, Guillermo Polito <guillermopol...@gmail.com>
>>> wrote:
>>> >
>>> > So I added an example of ProcessLocalSlot (like a thread local from
>>> other languages) using the existing ProcessLocalVariable. A variable has
>>> different values depending on the process the code is executing.
>>> >
>>> > Example of usage:
>>> >
>>> > Object subclass: #TestLocal
>>> >       slots: { #local => ProcessLocalSlot }
>>> >       classVariables: {  }
>>> >       category: 'SlotTestGuille'.
>>> >
>>> > object := TestLocal new.
>>> > object local: 55.
>>> > object local.
>>> >
>>> > [ valueInOtherProcess := object local ] fork.
>>> >
>>> > valueInOtherProcess. "=> nil"
>>> >
>>> > [ object local: 'String'.
>>> > valueInOtherProcess := object local ] fork.
>>> >
>>> > valueInOtherProcess. "=> 'String'"
>>> > object local "=> 55"
>>> >
>>> > Code in issue: https://pharo.fogbugz.com/f/cases/15004/Add-
>>> ProcessLocalSlot
>>> >
>>> > Guille
>>>
>>>
>>>
>>
>>
>> --
>> www.tudorgirba.com
>>
>> "Every thing has its own flow"
>>
>>
>>

Reply via email to