Closed Bug 415723 Opened 14 years ago Closed 14 years ago

Impossible to have multiple scripts sharing a global object

Categories

(Tamarin Graveyard :: Virtual Machine, defect)

defect
Not set
normal

Tracking

(Not tracked)

VERIFIED DUPLICATE of bug 417342

People

(Reporter: markh, Unassigned)

Details

ScreamingMonkey and ActionMonkey both have the requirement that they can compile multiple script blocks using a shared global.  This is currently impossible.  I'm pasting some notes from Edwin's email:

"""
I think there probably is no good way in tamarin to make a couple of different objects behave like a single one... too many issues fall through the cracks, as you are finding.
...
Perhaps the time has come to bend tamarin a bit; make esc compile toplevel far/function defs like ES3 compilers to (dynamically create the binding on a pre-existing global object), and make tamarin able to use an externally defined global object (window, in this case).  A global object could in fact be a window object, and it could have no statically defined traits.
"""
and from a later mail:
"""
here are what seem to be the options

1. have esc compile toplevel defs into expando setproperty ops, and 
mod tamarin to accept a host-defined object as a script's global object.
this === window === global

2. have esc compile toplevel defs into a global object's traits, but 
also let the host define the base class of the global object (say, 
global extends window).  this === window === global.

3. (current) have esc compile defs into global object's traits, and 
global extends Object.  this === global but this !== window

i think (2) is closest to what we want.  it itsn't fully js compatible 
since traits cannot be expanded once defined and (obviously) toplevel 
defs create DontDelete fixtures unlike in js.
"""
Marking this as a dupe of the new 417342, but this bug has some nice info from edwin
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 417342
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.