-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
----------------------------------------------------------------
script Outer1
parent: makeOuterParent(me)
-- At the time the value of parent is compiled, Outer’s parent is the top-level script,
-- whose parent is Support, which contains a top-level handler makeOuterParent.
-- makeOuterParent returns a script object (which are actually closures).
-- After parent is set to the newly obtained script object it can no longer access
-- any of the identifiers from its lexically enclosing (implicit) script object
--
-- I still don’t understand how the value of me is Outer during compilation, but ...
--------------------------------
script Inner1
parent: makeInnerParent(me)
--- commentary as above
-- -- do something ----
end Inner1
--------------------------------
script Inner2
parent: makeInnerParent(me)
--- commentary as above
-- -- do something ----
end Inner2
---- more Inner Scripts ----
end Outer 1
----------------------------------------------------------------
script Outer 2
---- Inner scripts ----
end Outer2
-------- more Outer scripts --------
runThem()
-----------------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------------
makeOuterParent and makeInnerParent “register” the scripts that call them in a list
in the process of constructing parents for the Inner and Outer scripts.
The handler runThem is run when this script is run.
runThem runs each of the Inner scripts of each of the Outer scripts that have registered themselves.
BUT IT DOES NOT RUN THE OUTER SCRIPTS.
Everything works fine, despite some further intense voodoo and heavy parenting inside of Support.
Now, the ONE DAMN FEATURE I want to add is to be able set a variable at the top level of Mine that is accessible inside of the Inner scripts. (If you are trying to think this through, remember that the parents of the top-level script, the Outer scripts, and the Inner scripts are all script objects in Support. Those script objects do have parents, but not each other, so there is no way to work through the parent hierarchy from an Inner handler to the top-level script's context.
Despite a great deal of wiggling, squirming, time spending, and appealing for help on pieces of this problem, I still do not have a solution. At this point I am convinced that there is none.
But wait! As often happens when trying to carefully and completely describe a problem, new solutions present themselves. I have another idea to try, but I'm going to leave this post for discussion while I go off and try it.
Thank you for listening. I hope you can follow my description -- and believe me, the reality is more complex than the abstraction presented above — and enjoy the challenge.
and what I need for my ONE DAMN FEATURE.