Question on snapshot and toggle methods in dependecy graphs

Beiträge: 115
Registriert: 15. Apr 2009 18:08
Wohnort: Ludwigshafen

Question on snapshot and toggle methods in dependecy graphs

Beitrag von burgi »

as I used snapshot and toggle methods of events within my implementation of stopwatch, the question arises how to model them within the dependency graphs. For my opinion the parameters should be modeled with dynamic dependency and the event "fireing" the methods should be modeled with static dependency.

For example:

Code: Alles auswählen

val event = new ImperativeEvent[Y] 
val a: Signal[X] = Signal {...}     
val b: Signal[X] = event.snapshot(a)
val c: Signal[X] = event.toggle(b, a)
So for the above code snippet my thoughts are: Signal c should be dynamically dependent on Signals a and b and statically dependent on event. Furthermore should Signal b be dynamically dependent on Signal a and statically on Event event.
Could someone veryfy my thoughts, or am I totally wrong ?

Thanks in advance DOminic

Beiträge: 61
Registriert: 21. Okt 2013 21:27

Re: Question on snapshot and toggle methods in dependecy gra

Beitrag von imaier »

As discussed elsewhere on this forum, there are actually four kinds of dependencies: a dependency that is active either temporarily or permanently. Each of these dependencies can be either -- well, let's call them -- reactive as sig in Signal { sig() } or only a value dependency as sig in Signal { sig.getVal }. The latter one only reads from sig but the resulting signal does not change in reaction to a change in sig. Please use dashed vs straight edges for the distinction between temporary and permanent dependencies as noted in the exercise description. Moreover, mark those edges that are not-reactive as in getVal.

This should give you the idea what to do in your examples. Hint: there are three kinds of dependencies for your b and c.

Hope that helps,


Zurück zu „Archiv“