fossilfree / numerous

Numerous - an object-oriented modelling and simulation engine.
https://numerous.com
BSD 3-Clause "New" or "Revised" License
14 stars 9 forks source link

if blocks and apparent circular dependencies #179

Open mrdobalina2k opened 2 years ago

mrdobalina2k commented 2 years ago

say you have this code in an @Equation() decorated function inside an item:

@Equation()
def eval(self, scope):
x = scope.y
if x > 0:
 x = 2

scope.x = x

you will get a circular dependency warning. If you write the code as this:

@Equation()
def eval(self, scope):
x = scope.y
scope.x = x
if x > 0:
  x2 = 2
  scope.x = x2

you don't get a warning. The code is the same. There should be no warning, since there is no true circular dependency.