First the motivation for this question: anyone who uses persistent data structures and a gui runs into this problem. So, my questions is kind of: do people just work it out on a case by case basis, or are their libraries, utilities, frameworks, something that abstracts the general case to make it easier to do.
The specific language I'm targeting is Scala, but I think this is a general question related to persistent data structures.
Let's say you have a large data structure displayed in a complex gui with trees, tables, property sheets, etc. Various user or system actions result in modifications to the data structure.
Is there a general strategy for handling notifications to tell the gui to update itself?
One of the intriguing ideas with persistent data structures is one could handle undo/redo by just switching between roots. That works for the data, but is there a general mechanism for telling listeners (eg. a gui) about the change if one were to switch roots?
My understanding is that it needs to be incremental--I need to know what changed. I can't just tell everything to do a complete refresh of the gui since that could be very expensive (and some controls don't handle it well (or at all) because of maintaining gui state).