Replies: 2 comments
-
One scheme that I currently use (not invented by me though 😛): When a parent is constructing, it will also set children's (childA & childB's) parameters for configuring their behaviors.
I think that would be useful -- basically you're setting a 'formula' for a parameter based on another resource's parameter, right? Then we can save tons of setup codes in either parent or child node .. Another risk I can think of is: what if multiple observers are registered to a parameters? Do you allow that? Otherwise, an precedence is required otherwise the value would be undeterministic. |
Beta Was this translation helpful? Give feedback.
-
Zen's answer is right on target. The way I think about it is that the parent dictates the children's behavior, and since they are presumably tried at the hip w.r.t. that behavior, the parent should communicate down what the children should do. To make this easier. however, that will require that the parent own/create the children outright, meaning that the parent's factory create those children during runtime and pass that behavior down during resource tree node creation. An example of that is here in the Olympia core model's execution pipeline. In that example code, the Execute unit is the parent ( Sparta parameter ordering will allow those parameter in the child to be overridden. |
Beta Was this translation helpful? Give feedback.
-
Let's say you have something the config dumper would show as:
Now, let's say that
parent
,chlidA
andchildB
all have behavior that depends ontop.parent.params.meaning_of_the_universe
, what's the best way forchildA
andchildB
to access the param?There are also more convoluted cases where you have cousins spread out in the tree that need to know about each others' parameters. I know that depending on how you do this, you can run into tree build order issues if you walk the tree trying to look up parameter values.
Would it be useful for different Resources to be able to register as Observers of a View of other Resources' parameters? Or, is this intentionally not provided because it runs afoul of the Sparta design?
Beta Was this translation helpful? Give feedback.
All reactions