It looks like you're new here. If you want to get involved, click one of these buttons!
I'm wondering if I am using cache nodes right, and if using them wrong could cause unwanted side effects.
As I understand, a cache prevents upstream evaluation unless some input to the upstream changes.
There are many cases where this sounds handy - any time there is an expensive operation, I put a cache in.
However, the cache tries to make its value immutable. I see the sense of this for simple values, but for a complex class it just doesn't work. For example, I have one expensive operation (constructing an agent), another expensive operation (building a path), then a final expensive operation (generating/updating renderable items). Each of these operations are self contained, dependent on the prior state, but does not override the previous values.
In these cases, I'm getting around the caching by just casting away the const in KL, but this seems somehow... not good.
I guess if I was starting from Canvas rather than porting from KL, I would design the system so that each nodes output only related to what that node calculated (instead of having one container object that flowed through the whole graph. This sounds probably cleaner, but...
Is there any problems I might run into due to de-consting my cached instances? Is there a better method rather than what I'm doing?
©Copyright 2017 Fabric Software Inc. All rights reserved. | Privacy