In the last episode of “Under the hood” we learnt that everything  in Perspective runs on the GW
In order to better understand the technical details of this, I want to ask about the mechanism that evaluates a binding (and then ask about interactions with event scripts)
Say that we have a label object that has its fill property bound to a tag via a simple expression like:
From an HMI user’s point of view, when the value of “ExternalBoolTag” changes between True and False, the expression returns Green or Red RGB colors. And the Fill color of the label receives this value and the label changes visually to match the result.
But I want to understand the action from a “GW behind the scenes programming” point of view.
The following is my interpretation of how this could work in the GW :
- The ExternalBoolTag is an object sitting in a chunk of memory in the GW
- The label is another object sitting a different chunk of memory.
- The expression binding is another object that sits somewhere else, and is registered with both the tag and label via some sort of hooks or lists of objects or list of object pairs.
When something writes a new value into ExternalBoolTag :
- It triggers an action that iterates over all the different things that are registered to that tag. One of the registered items is the expression binding of the label.
- When the expression binding is encountered, it kicks off a process that evaluates the expression with the current value of ExternalBoolTag
- The evaluation process then writes the color value into the fill property of the label object
- The writing of fill property  triggers another process that causes the Perspective module to re-render the label with the new fill color, and send it off to the Perspective session that is displaying it.
So from a mile high point of view, is the above process somewhere in the realm of what actually happens when evaluating an expression binding? And that everything happens asynchronously, triggered by the write into ExternalBoolTag?
Adding on to this, if the label had a user triggered Event attached to it, that then ran a script that wrote the value of ExternalBoolTag, would the following sequence also be basically true?
- User clicks on the label
- The Perspective session detects the click and sends a message back to the GW saying that a click was detected on the label 
- The GW  invokes a script runner to execute the script attached to the event.
- During the execution of the script, a new value is written to ExternalBoolTag
- The script running finishes executing the script.
If this is also basically correct, my question is when step 4 is reached, where ExternalBoolTag is written, does this asynchronously  kick off the previously noted expression binding sequence? Or does the Event script need to terminate before the Expression binding gets evaluated? My gut feeling says “asynchronous execution” due to an overall event driven programming model, but I could be wrong.
One implication of this is data coherence in the event script. If the script both sets the value of ExternalBoolTag, and also reads the value of the label’s fill color  then depending on the programming model the value of the fill color that was read may or may not be up to date.
 For differing values of “everything”
 Not sure if the process is triggered on a simple write, or on a write of a different value.
 Or the session just sends the mouse co-ordinates back to the GW which figures itself which object was clicked. That’s probably a React implementation detail.
 Probably the “Perspective module” in the GW might be more accurate
 As asynchronously as can be with a CPU with a finite number of cores.
 Yes, a very stupid thing to do.
 In my descriptions I may be using some terms that have a specific meaning in a programming environment in a very loose manner. So take it all with a bag of salt (a grain of salt is too small in this case!)