-
-
Notifications
You must be signed in to change notification settings - Fork 30
Open
Description
The following code and comment in Signal.scala
:
/** 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.
Metadata
Metadata
Assignees
Labels
No labels