On Thu, 7 Dec 2006, Cyril Concolato wrote:
Is the ECMAScript syntax in the 'implementation' element free like:
<implementation>
foo = 1;
</implementation>
or shall/should it obey some specific ECMAScript syntax (as all the
examples in the specification suggest), i.e. start with ({, contain only
fonction declarations, and end with }).
The spec requires that whatever is executed evaluate to an object. So I
guess you could do something like:
<implementation>
var x = new Object();
x.foo = 1;
x;
</implementation>
If the syntax is free, please say so in the specification. If not,
please give link to specifics constructs allowed from the ECMAScript
specification. This would satisfy me.
This is already covered by section 5.4 as far as I can tell.
(Specifically, 5.4.1.)
I must have missed that part when reading it the first time. The
sentence "If the script evaluates to an object, then that is the
On Fri, 8 Dec 2006, Marcos Caceres wrote:
Cyril raises an interesting point there regarding implementations and
how they should be handled by scripting langauges within the context of
XBL. For ECMAScript, it might be nice to write the constructor without
using the old ({ ... }). Can I do the following?:
<implemenation>
//where "this" is the scope of this implementation
this.x = 1234;
this._y = 4321;
this.funky = function(){...}
this._helper = {( functionName: function() { return true; })}
</implemenation>
"this" in this context would be "window", so that wouldn't work. But
things like the example above would, as far as I can tell. (I'm no JS
expert.)