Module with state - how to implement?

Thanks for the answer! I don’t really have to do it like that, I just believe it’s nicer for the user.

Now that I have you here, here’s a follow up. You defined Base.:+(x::TrackedVar, y::TrackedVar) . What if I wanted to implement the same idea, but which works with a general function? For example, z = f(x, y) . Any idea how to do that?