A random collection of ES4 draft spec surprises and thoughts

Maciej Stachowiak mjs at apple.com
Mon May 26 23:40:59 PDT 2008


On May 26, 2008, at 11:58 AM, Jason Orendorff wrote:

> I can answer two more :)
>
> On Mon, May 26, 2008 at 1:06 PM, Mark S. Miller <erights at google.com>  
> wrote:
>> * What does the "var" attribute mean inside an object literal?
>
> See Lars's "ES4 stable draft: Object initializers":
>  https://mail.mozilla.org/pipermail/es4-discuss/2008-April/002668.html
>
>> * Why does the grammar allow function calls in
>> LeftHandSideExpressions. For example, what's the meaning of
>>
>>   foo(a)++
>>
>> ?
>
> As far as I know, this is unchanged from ES3, in which "functions are
> permitted to return References" but "This possibility is admitted
> purely for the sake of host objects. No built-in ECMAScript function
> defined by this specification returns a reference and there is no
> provision for a user-defined function to return a reference.":
>  http://bclary.com/2004/11/07/#a-8.7
> and an implementation that doesn't hold with such nonsense is also
> allowed to reject "foo(a)++" as a syntax error:
>  http://bclary.com/2004/11/07/#a-16

In practice, for Web compatibility, it has to be a runtime error not a  
parse error. I don't know of any implementation making use of a  
function returning a reference however (in WebKit's implementation  
Reference is not a real type, just a spec fiction, and I assume this  
is true in other implementations).

  - Maciej




More information about the Es4-discuss mailing list