Announcer problem :)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Announcer problem :)

Stéphane Ducasse
addDependent: anObject

        self announcer
                on: MorphChanged
                do: [ :ann | anObject update: ann selector ].
               
        self announcer
                on: MorphChangedWithArguments
                do: [ :ann | anObject update: ann selector with: ann arguments ].
                       
        ^ anObject

is an example of the problem because addDependent: was holding also weakly its dependent and now
we cannot use weak with blocks.

Stef
Reply | Threaded
Open this post in threaded view
|

Re: Announcer problem :)

Stéphane Ducasse
So igor is thinking about ephemerons and object formats.
Because we are going over all the weak on:do: and rewriting the ones we can.


whenListChanged: aBlock
        "Specify a block to value after the contents of the list has changed"

        "Basically when you set a new list of items"

        <api: #event>
        | block |
        block := [ :announcement :ann |
        aBlock
                cull: announcement newContents
                cull: announcement oldContents
                cull: announcement
                cull: ann ].
        listAnnouncer weak
                on: ValueChanged
                do: block


On Aug 4, 2013, at 4:16 PM, Stéphane Ducasse <[hidden email]> wrote:

> addDependent: anObject
>
> self announcer
> on: MorphChanged
> do: [ :ann | anObject update: ann selector ].
>
> self announcer
> on: MorphChangedWithArguments
> do: [ :ann | anObject update: ann selector with: ann arguments ].
>
> ^ anObject
>
> is an example of the problem because addDependent: was holding also weakly its dependent and now
> we cannot use weak with blocks.
>
> Stef


Reply | Threaded
Open this post in threaded view
|

Re: Announcer problem :)

Stéphane Ducasse
The real problem is that the error that was raised on on:do: was removed and now...

NewValueHolder>>whenChangedDo: aBlock

        | block |
        block := [:announcement :ann | aBlock cull: announcement newContents cull: announcement oldContents cull: announcement cull: ann ].
        announcer weak on: ValueChanged do: block

Now may be it is not a problem and a strong reference is ok too.
We will have to analyse that.

Stef



> So igor is thinking about ephemerons and object formats.
> Because we are going over all the weak on:do: and rewriting the ones we can.
>
>
> whenListChanged: aBlock
> "Specify a block to value after the contents of the list has changed"
>
> "Basically when you set a new list of items"
>
> <api: #event>
> | block |
> block := [ :announcement :ann |
> aBlock
> cull: announcement newContents
> cull: announcement oldContents
> cull: announcement
> cull: ann ].
> listAnnouncer weak
> on: ValueChanged
> do: block
>
>
> On Aug 4, 2013, at 4:16 PM, Stéphane Ducasse <[hidden email]> wrote:
>
>> addDependent: anObject
>>
>> self announcer
>> on: MorphChanged
>> do: [ :ann | anObject update: ann selector ].
>>
>> self announcer
>> on: MorphChangedWithArguments
>> do: [ :ann | anObject update: ann selector with: ann arguments ].
>>
>> ^ anObject
>>
>> is an example of the problem because addDependent: was holding also weakly its dependent and now
>> we cannot use weak with blocks.
>>
>> Stef
>
>