Implement stored calc based on another stored calc

is it possible to base a stored calc on another stored calc?
Let’s assume I have Type1.field1 that is a stored calc…
and I need to implement something like this

count (Type2.Type1.path.path1.path2 == Type1.field1) > 1 ? true : false

Yes, we have stored calcs off of stored calcs all over the place. Check Organization or Facility types, there will be a bunch.

What is the recommended architecture for nested stored calcs? For instance:

entity Type A schema name "TYPE_A" {
    fieldA: int
    fieldB: int
    
    storedFieldA: int stored calc "fieldA + fieldB"
    storedFieldB: int stored calc "fieldA + storedFieldA"
    storedFieldC: int stored calc "storedFieldA + storedFieldB"
}
entity Type A schema name "TYPE_A" {
    fieldA: int
    fieldB: int
    
    storedFieldA: int stored calc "fieldA + fieldB"
    storedFieldB: int stored calc "fieldA + fieldB + fieldA"
    storedFieldC: int stored calc "fieldA + fieldB + fieldA + fieldB + fieldA"
}

Though the second one looks more complicated to read when refreshCalcFields is run the calculations don’t need to run multiple times correct? The first example storedFieldC will be invalidated after each of its dependent stored calc is updated. This can get really complicated as the nested calcs get deeper or more are relied on.

I think A is preferred unless you’re really stretching the boundaries of data volume.

The relative value of a little bit of performance vs readability/understandability is very small.

As a comparison, whats the preferred architecture for writing apps code on the C3 AI Suite, Java or Javascript?

Java is 10x faster, but javascript has a whole load of other advantages, so normally we go with javascript.