- From: Ian Hickson <ian@hixie.ch>
- Date: Fri, 5 Jan 2007 23:50:43 +0000 (UTC)
- To: Cyril Concolato <cyril.concolato@enst.fr>, Marcos Caceres <m.caceres@qut.edu.au>, Cameron McCormack <cam@mcc.id.au>
- Cc: "WAF WG (public)" <public-appformats@w3.org>
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.)
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.)
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
Received on Friday, 5 January 2007 23:50:56 UTC