Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object literal extensions not working with --es_staging/--harmony flags #685

Closed
lozandier opened this issue Jan 31, 2015 · 2 comments
Closed

Comments

@lozandier
Copy link

For some reason, Object literal extensions involving Symbols (like creating your own @@iterable) doesn't seem to be working; an example of usage that works within 6t05, Traceur, and es6fiddle.net is below this paragraph as a code snippet:

let fooCollection = {
  itemsToIterate = [],
  *[Symbol.iterator](){
     yield *this.itemsToIterate.values();
}

fooCollection.items.push(1);
fooCollection.items.push(2);
fooCollection.items.push(3);

for ( let  itemToIterate of FooCollection){
  console.log(itemToIterate);
}

Here's successful example running within ES6 Fiddle I've screen captured as well:
screen shot 2015-01-31 at 6 40 20 pm

Seemingly, including the fact literal shorthands of declaring properties also doesn't work for me with iojs at the moment, the docs may need to be edited to omit Object literal extensions being covered by --es_staging or --harmony

The error typically thrown by iojs when running scripts attempting to use object literal extensions is screen captured below:
screen shot 2015-01-31 at 9 42 06 pm

@vkurchatkin
Copy link
Contributor

Then there are staged features which are almost-completed features that haven't been completely tested or updated to the latest spec yet and therefore are not considered stable by the V8 team (e.g. there might be some edge cases left to discover)

Also what you want is consider a separate feature - "computed property names": https://code.google.com/p/v8/issues/detail?id=3754

@jordaaash
Copy link

I also ran into this issue. The official ES6 docs for io.js link to here which includes computed property names in enhanced object literals. It could probably be made more clear that they aren't supported in io.js yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants