I suppose some of this might be in a FAQ or something, but I'm somewhat lazy and I've got some questions burning.
I also apologize for A) not knowing CL very well B) not knowing very much about CLOS at all (except what it stands for). Please pardon any strange or misused terminology.
That said, I've got some questions about how Cells works.
1) Synchronicity, or the currency conversion problem: Let's say I define a slot in an object that represents the amount of US Dollars I have in a bank account. Let's further say that in my app I also want to represent the amount of Japanese Yen in my account. If someone "sets" the amount of dollars, I want the yen slot to be updated. If someone sets the yen, I want the dollars to be updated. Is there a mechanism to create such co-dependent cells? (Obviously this is addressing the update cycle problem, and at the shortest path level: A depends on B depends on A (length 1), which forms a very useful group of calculations).
2) Equals: It looks like, from reading 01-Cell-basics.lisp, that setting a slot to an "equivalent" object does not cause all its dependencies to fire again (in order to save substantial useless recalculations). What does "equivalent" mean? Can I install my own equivalency operator, per slot (or per class would be fine) so that Cells knows when computations should be rerun?
3) Lack of values, or triggers: It's easy to come up with typed slots that participate in calculations. However, what about untyped events? For instance, a press of a button conveys no useful state information. Is it possible in Cells to make slots dependent upon the "change" of a stateless slot? (This sort of ties back into the equals business...I understand you could implement this sort of functionality by setting a slot to, for example, a gensym uninterned symbol, so that there is no useful value and it's sure to cause everything to recalculate by any useful definition of equals, but this solution is...well, kind of ugly. It would be nice to be able to define the recalculation or "firing" semantics of a slot, which is a superset of the "equals" issue above).
4) Transactions: Let's say you have 50 or 60 slots that are connected in a complicated graph of calculation. A change to one slot (let's call this "initiation") causes all of these guys to start running until finally the system reaches a steady state and no more changes occur. We could conceptualize this initiation, subsequent calculations and then collapse into steady state as a single "transaction."
Now, imagine that at the second-to-last calculation of this propagation of values, the system enters a state of inconsistency. In other words, the initiation of that one state change way back in the beginning is actually invalid. However, we don't know that (given that this is a nice event-driven framework) until step 52, and we've got 40 slots that are all now different than they were, and *wrong*. Ideally, it would be nice to have mechanism that A) notifies the programmer, similar to a "catch" construct, so that s/he can note it in an appropriate fashion, and B) restores all the slots in the system to the last known good steady state; i.e., what they were before the initiation occured.
Does Cells have a transaction model similar to this? If so, can someone explain it? Are there separate phases of execution in the transaction? Are there separate "guards" that are responsible for determining the validity of system state? Is there a way to specify that slots get updated only once the system state becomes steady; i.e. they don't participate in the middle of the transaction? (These beasts have quite a few constraining properties, I realize, but they could (are) be very useful to reduce the amount of "spinning" the recalculation has to do).
Thanks in advance for all your comments.
Mike