From: Jim Cain Date: 2003-07-03T15:16:58+09:00 Subject: Auto-serialization (as in Vapor, sql-serialize, etc.): detecting changes to instance variables All, I'm working on the same problem as has been encountered in the projects named above: It would be very handy to have a way to trap changes to an instance variable... perhaps a callback in the same spirit as Kernel#trace_var. To be really useful it would have to be attached to the instance variable itself, not just to the accessor methods. There is a problem even with this low level of control, however. Suppose you have a reference R outside of a particular object S that you're interested in serializing, and that the reference R points to an object that one of S's instance variables points to. In other words, this is true: R.equal?(S.iv) How can you detect, from S, that a change to S.iv has been made through R, without doing something like comparing the before and after serializations of S? Would it be possible to create a callback that was attached to the referred-to object (*R or *S.iv in C-speak), rather than to the instance variable? Food for thought. Cheers, Jim