You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/** Here we need to ensure that Signal's default value has been evaluated.
* It is important because if a Signal gets started by means of its .changes
* stream acquiring an observer, nothing else would trigger this evaluation
* because initialValue is not directly used by the .changes stream.
* However, when the events start coming in, we will need this initialValue
* because Signal needs to know when its current value has changed.
*/
override protected[this] def onStart(): Unit = {
tryNow() // trigger setCurrentValue if we didn't initialize this before
super.onStart()
}
is seemingly inconsistent with the behaviour initial value Failure() when .changes is the only consumer test and the documentation written based on the tested behaviour.
Figure out who is right, and if it's the documentation, figure out why the code isn't doing what it says it's doing. Perhaps the test behaviour is due to the very immediate nature of EventStream.fromSeq?
Also, we need to decide which behaviour is actually desirable, and document our reasons.
If we needlessly evaluate initialValue, how do we report errors from it? State needed special treatment for that.
If we don't evaluate initialValue, how is that a problem? Make a test that demonstrates the problem.
The text was updated successfully, but these errors were encountered:
raquo
changed the title
Verify Signal's initialValue laziness
Test: Verify Signal's initialValue laziness
Dec 22, 2018
The following code and comment in
Signal.scala
:is seemingly inconsistent with the behaviour
initial value Failure() when .changes is the only consumer
test and the documentation written based on the tested behaviour.Figure out who is right, and if it's the documentation, figure out why the code isn't doing what it says it's doing. Perhaps the test behaviour is due to the very immediate nature of
EventStream.fromSeq
?Also, we need to decide which behaviour is actually desirable, and document our reasons.
initialValue
, how do we report errors from it? State needed special treatment for that.initialValue
, how is that a problem? Make a test that demonstrates the problem.The text was updated successfully, but these errors were encountered: