Accessing/Intercepting Nashorn's Global Object Variables
<p>This is along the same lines as the question titled <a href="https://stackoverflow.com/questions/35807683/capturing-nashorns-global-variables">"Capturing Nashorn's Global Variables"</a>. I'm finding it very limiting not being able to intercept the assignment of variables to the global object. </p>

<p>For instance, say I eval the script "a = 10". Perhaps I want to call a listener to notify something that 'a' was added to the scope. The only way I could do this is to investigate the global object after the script is eval'd. </p>

<p>Or say i want to intercept an object being assigned to the global scope and substitute it for another; if it was using <code>Bindings</code> I could implement <code>put</code>, and delegate off to some other bindings: </p>

<pre><code>public Object put(String name, Object value) {
    //put a toStringed version of the object in scope
    return delegate.put(name, value+"");
}
</code></pre>

<p>This way, when the code 'a=10' is evalled, it would put "10" in scope instead of 10. </p>

<p>It's handy having a <code>Bindings</code> interface to implement, but frustrating that I can't provide something like this implementation for the global object. <code>ScriptObjectMirror</code> is final, so I can't even overload this and hijack the subsequent call to the internal <code>ScriptObject</code>. Am I missing something?</p>