Gecko object key interpretation specific: a bug or a feature?

View: New views
4 Messages — Rating Filter:   Alert me  

Gecko object key interpretation specific: a bug or a feature?

by VK-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Having a statement such as:

var obj = {
 foo: 'bar',
 default: 'default_value'
}

Firefox 3.5.3 creates obj with properties foo and default.

IE reports syntax error "Expected identifier, string or number", same
or similar syntax error occurs on Safari, Chrome and Opera. By placing
default into quotes we are making the code valid for all browsers in
question:

var obj = {
 foo: 'bar',
 'default': 'default_value'
}

My question is if it is a Gecko bug, a convenience extension or the
proper implementation by ECMA with others being wrong on that?
_______________________________________________
dev-tech-js-engine mailing list
dev-tech-js-engine@...
https://lists.mozilla.org/listinfo/dev-tech-js-engine

Re: Gecko object key interpretation specific: a bug or a feature?

by Ash Berlin-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On 24 Oct 2009, at 20:20, VK wrote:

> Having a statement such as:
>
> var obj = {
> foo: 'bar',
> default: 'default_value'
> }
>
> Firefox 3.5.3 creates obj with properties foo and default.
>
> IE reports syntax error "Expected identifier, string or number", same
> or similar syntax error occurs on Safari, Chrome and Opera. By placing
> default into quotes we are making the code valid for all browsers in
> question:
>
> var obj = {
> foo: 'bar',
> 'default': 'default_value'
> }
>
> My question is if it is a Gecko bug, a convenience extension or the
> proper implementation by ECMA with others being wrong on that?

This is a spidermonkey 'bug' in the default is in the list of future  
reserved words by the ES262 (ECMAScript 3) spec.

Wether its actually a problem or not is another matter of course.


_______________________________________________
dev-tech-js-engine mailing list
dev-tech-js-engine@...
https://lists.mozilla.org/listinfo/dev-tech-js-engine

Parent Message unknown Re: Gecko object key interpretation specific: a bug or a feature?

by Brendan Eich-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Oct 24, 12:59 pm, Ash Berlin <ash...@...> wrote:

> On 24 Oct 2009, at 20:20, VK wrote:
>
>
>
> > Having a statement such as:
>
> > var obj = {
> > foo: 'bar',
> > default: 'default_value'
> > }
>
> > Firefox 3.5.3 creates obj with properties foo and default.
>
> > IE reports syntax error "Expected identifier, string or number", same
> > or similar syntax error occurs on Safari, Chrome and Opera. By placing
> > default into quotes we are making the code valid for all browsers in
> > question:
>
> > var obj = {
> > foo: 'bar',
> > 'default': 'default_value'
> > }
>
> > My question is if it is a Gecko bug, a convenience extension or the
> > proper implementation by ECMA with others being wrong on that?

Not a bug, yes a convenience, and proper implementation of ES5 (after
ES3.1 and ES4, which both allowed reserved words to be used in
property-name contexts). Also a proper extension to ES3, which allows
such syntactic extensions (see chapter 16).

IE has yet to ship the ES5 JScript implementation I've seen demo'ed at
Ecma TC39 meetings.


> This is a spidermonkey 'bug' in the default is in the list of future  
> reserved words by the ES262 (ECMAScript 3) spec.

No, 'default' is not future-reserved in ES2 or ES3 -- it's used in
switch statements.

/be
_______________________________________________
dev-tech-js-engine mailing list
dev-tech-js-engine@...
https://lists.mozilla.org/listinfo/dev-tech-js-engine

Re: Gecko object key interpretation specific: a bug or a feature?

by VK-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

VK wrote:

> > > Having a statement such as:
>
> > > var obj = {
> > > foo: 'bar',
> > > default: 'default_value'
> > > }
>
> > > Firefox 3.5.3 creates obj with properties foo and default.
>
> > > IE reports syntax error "Expected identifier, string or number", same
> > > or similar syntax error occurs on Safari, Chrome and Opera. By placing
> > > default into quotes we are making the code valid for all browsers in
> > > question:
>
> > > var obj = {
> > > foo: 'bar',
> > > 'default': 'default_value'
> > > }
>
> > > My question is if it is a Gecko bug, a convenience extension or the
> > > proper implementation by ECMA with others being wrong on that?

Brendan Eich wrote:
> Not a bug, yes a convenience, and proper implementation of ES5 (after
> ES3.1 and ES4, which both allowed reserved words to be used in
> property-name contexts). Also a proper extension to ES3, which allows
> such syntactic extensions (see chapter 16).
>
> IE has yet to ship the ES5 JScript implementation I've seen demo'ed at
> Ecma TC39 meetings.

Thank you for your clarification.


_______________________________________________
dev-tech-js-engine mailing list
dev-tech-js-engine@...
https://lists.mozilla.org/listinfo/dev-tech-js-engine