Table of Contents

Interface IWritableBindableValue<T>

Namespace
SodaFlow.Bindable.ObjectModel
Assembly
SodaFlow.Core.Bindable.ObjectModel.dll

A bindable value that the view can write to. This interface gives an ability and not a direction. ITwoWayBindableValue<T> and IOneWayToSourceBindableValue<T> the two supply it. Thus, a method that only sends a value into the graph can accept each one.

[PublicAPI]
public interface IWritableBindableValue<T> : IBindable, IDisposable

Type Parameters

T
Inherited Members
Extension Methods

Remarks

Value is for the binding engine to read and write, and for no other code. A read or a write from the code of an application is a procedural path around the graph. The value that it gives is a value that the graph holds, and a value that you send into it is a value that you can send to a sink. Use cells and streams instead.

The rule about threads comes from that. You can construct a bindable on any thread, but only the binding thread touches the property, because a binding engine calls from there. Thus, the cached value below it is a usual field, with no synchronization and no allocation for each change. A read or a write from a different thread removes that condition, and gives no warning. The result is a stale value, or an incomplete value when T is a large struct.

A write goes into the graph in a transaction, and SodaFlow runs one transaction at a time across the process. Thus, a set waits until each open transaction closes. That wait is usually too small to measure, and it is the same guarantee that makes synchronization by hand unnecessary. But a transaction that runs for a long time on a background thread delays the setter, and with it the binding thread, for the full time that it runs.

A throw from the graph does not leave the setter. A binding engine catches a throw from a setter, and can discard it or show it as a validation error. A throw from the graph is a defect, thus the setter gives it to the scheduler, which throws it on the binding thread. A scheduler on a message loop lets it reach that loop. Immediate throws it immediately, thus the caller of the setter gets it. A write in an open transaction waits for the close of that transaction, and a throw leaves that close.

Properties

Value

Gets the current value, or writes a new value into the FRP graph. This is for the binding engine, on the binding thread. See the remarks on this interface.