Method WithCaptures
- Namespace
- SodaFlow
- Assembly
- SodaFlow.dll
WithCaptures<TCaptures>(Func<LoopedCell<T>, (T Value, TCaptures Captures)>)
Constructs a value which can refer to itself, along with anything else worth keeping from its construction.
[Pure]
public static (T Value, TCaptures Captures) WithCaptures<TCaptures>(Func<LoopedCell<T>, (T Value, TCaptures Captures)> f)
Parameters
fFunc<LoopedCell<T>, (T Value, TCaptures Captures)>A function which takes a forward reference to the value it is producing, and returns that value along with the captures.
Returns
Type Parameters
TCapturesThe type of the captures to return.
Remarks
The captures are for the parts that this code makes with the value, and
that the value does not give. Examples are a sink that sends to it, and an
internal cell to monitor. No code can get these after the function returns.
The function gives TCaptures to type inference.
ForwardReference<T> itself names T,
which is what leaves it free. A lambda gives type inference nothing to work
from, and C# does not accept only some of the type arguments of a method.
Thus, a second name here makes a caller write the two at each call.