jamesjuett / lobster

Interactive Program Visualization Tools
8 stars 3 forks source link

String content doesn't update when individual characters are changed #186

Open jamesjuett opened 3 years ago

jamesjuett commented 3 years ago

Pretty sure this is because the string doesn't receive a notification that individual array element objects have changed because it refers to its internal character array via pointer.

This is sort of a general issue to solve, since there are plenty of objects that might have custom displays (not just a display that shows individual element objects, which would update themselves ok - I believe this is why the issue doesn't exist for vectors) and need to be notified of a change to a member object.

Maybe there would be some way to create a special relationship between the object and its indirectly held resources? This relationship would need to be maintained even if the resources is freed and reallocated, so that's a bit of trickiness.

jamesjuett commented 3 years ago

Could potentially solve the general issue here by having "object" and "array" pointer objects listen for events indicating the beginning and end of lifetimes of the objects the point to.

Or, perhaps it would be more appropriate for the outlets that correspond to these kind of pointers to listen to the objects they point to, and then update listener relationships as appropriate when there are lifetime changes to those objects or when the value of the pointer is assigned and comes in with a new ObjectPointer or ArrayPointer type.