Deprecating ValueHolder (call for Spec user)

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

Deprecating ValueHolder (call for Spec user)

Stephane Ducasse-3
Hi

we have ValueHolder and NewValueHolder
so I wanted to remove the 6 last user of ValueHolder.

Now I see that we have

ValueHolder >> contents: newContents
      contents := newContents.
      self changed: #contents

NewValueHolder >> value: anObject
    self handleCircularReferencesWhile: [ | oldValue |
    oldValue := value.
    value := anObject.
    self valueChanged: oldValue ].

    ^ value

So

dialog newSliderFor: (ValueHolder new contents: 0.5)
getValue: #contents setValue: #contents: help: 'This is a slider').

=>
(dialog newSliderFor: (NewValueHolder new value: 0.5; yourself)
getValue: #value setValue: #value: help: 'This is a slider').

and I find that boring to have to be forced to use yourself.

as an experiment I changed the definition of value: to

NewValueHolder >> value: anObject
    self handleCircularReferencesWhile: [ | oldValue |
    oldValue := value.
    value := anObject.
    self valueChanged: oldValue ].

Now I'm looking for spec users to tell me if I break something.

Stef