SeedV / SeedLang

An embeddable and visualizable scripting engine for .Net and Unity.
https://seedv.github.io/SeedLang/
Apache License 2.0
9 stars 1 forks source link

How to monitor the value change made via another reference variable? #190

Open wixette opened 2 years ago

wixette commented 2 years ago

Given the following example code:

a = [1, 2, 3]
b = a
b[2] = 10

How can the visualizer know the content of the list a has been changed when it receives the assignment notification about b[2] = 10?

wixette commented 2 years ago

My understanding is we probably need to align with the design of a typical debugger/inspector somehow.

E.g., it's somehow hard to automatically notify users about the change of a's element when b[2] = 10 is executed. But it's somehow easy to provide visualizers with a convenient interface to evaluate or retrieve the current values of a's items whenever the visualizer wants to.

In this way, the visualizer can check a's content each time a SingleStep notification is got, so that it will know the change of a's content immediately when b[2] = 0 is executed. It's very much like adding a watcher/monitor of a variable to a typical debugger/inspector, right?

Just my two cents.