On 20 Jan 2014, at 15:36, Sean P. DeNigris <sean@clipperadams.com> wrote:
I had some questions about NewValueHolder and I figured, why not revive COTDC?!
I loved it :)
The current comment is: "A NewValueHolder is a new implementation of ValueHolder based on Announcements". Of course, ValueHolder doesn't have a class comment. Wikipedia claims a value holder is "a generic object that handles the lazy loading behavior, and appears in place of the object's data fields" [1]. So: - what is a NewValueHolder?
I am a class holding any object inside its unique instance variable. Each time the instance variable value changes, an announcement is emitted. The instance variable is accessed through `value` and `value:` while the registration is done by `whenChangedDo: aBlock`. In addition, infinite loops of propagation are prevented. Use case: you have two lists A, and B, and you want to keep their selection synchronised. So when A selection changes, you set B selection. But since B selection changes, you set A selection, and so on⦠This case is prevented by the use of value holders.
- is the "Value Holder" part of the name accurate in light of [1].
Nope :(
Obviously repurposing a term people may already be familiar with is a bad idea.
Itâs called NewValueHolder because itâs a re-implementation of ValueHolder :) I did not checked the name :P
In fact the important part here seems not the holding of the value, but the notification of changes.
Indeed
It seems more like an event in FRP. How about ReactiveVariable or AnnouncingVariable, since it combines the storage of a variable with announcing of changes? I like Reactive a bit better because those familiar with FRP will get the idea that it's notifying dependents, Announcing maybe begs the question "announcing what?â
I like Reactive too. It sounds like we are doing cool things :P
- should it replace ValueHolder, which is used only by ExclusiveWeakMessageSend and WidgetExamples
Might be yes, I did not checked the users of ValueHolder in a while.
p.s. [OT] valueChanged: oldValue to: newValue seems fishy. It is only used in one place in the image in this weird way "pickedItemsHolder valueChanged: true to: itemâ
Probably a bad hack I did :P Ben