Dep is very much like a Val, but is also a Channel. The basic purpose is to represent a value dependent upon
another variable. An example of this might be if you are representing a position left and you also wanted to
represent right as well (which would be left + width). These two variables are dependent upon each other and
don't fit well as Vars. An example usage might be:
val left: Var[Double] = Var(0.0)
val width: Var[Double] = Var(0.0)
val right: Dep[Double, Double] = Dep(left, width)
If an instance is submissive it removes adjustment from being part of the mutation dependency. For example: in
the above scenario if you set width to 100.0 and right to 125.0 then left will be 25.0. Now, what should happen
if you change width to 50.0? Should left change to 75.0 (submissive = false) or should right change to 75.0
(submissive = true)?
Dep is very much like a
Val
, but is also aChannel
. The basic purpose is to represent a value dependent upon another variable. An example of this might be if you are representing a positionleft
and you also wanted to representright
as well (which would beleft
+width
). These two variables are dependent upon each other and don't fit well asVar
s. An example usage might be:val left: Var[Double] = Var(0.0) val width: Var[Double] = Var(0.0) val right: Dep[Double, Double] = Dep(left, width)
If an instance is
submissive
it removesadjustment
from being part of the mutation dependency. For example: in the above scenario if you setwidth
to 100.0 andright
to 125.0 thenleft
will be 25.0. Now, what should happen if you changewidth
to 50.0? Shouldleft
change to 75.0 (submissive = false
) or shouldright
change to 75.0 (submissive = true
)?