Questions tagged [ecmascript-harmony]

ECMAScript Harmony is the code name for proposals aiming to extend the current ECMA-262 specification.

ECMAScript Harmony is the code name for proposals aiming to extend the current ECMA-262 specification and to form the new . It names the agreed design trajectory of post-ES5 editions. It will include syntactic extensions, but the changes will be more modest than ECMAScript 4 in both semantic and syntactic innovation.

Packages, namespaces, and early binding from ECMAScript 4 are no longer included for planned releases, and don't live under the roof of Harmony.

References

  1. ECMAScript - Wikipedia
  2. ECMAScriptHarmony - ECMAScript.org
239 questions
0
votes
0 answers

What is the difference between `yield` and `yield *`

Can someone explain the difference between yield and yield *? var foo = yield fn; var foo = yield* fn;
Mark Kahn
  • 81,115
  • 25
  • 161
  • 212
0
votes
2 answers

Trying to `yield` to a `co( fn ).call`

I'm having a problem getting co to resume when also changing it's context value: var co = require( 'co' ); function *foo( next ){ console.log( 'foo yielding' ); yield next; console.log( 'foo yielded' ); return 42; } var bar = co(…
Mark Kahn
  • 81,115
  • 25
  • 161
  • 212
0
votes
2 answers

How can we use generators to write async code in a sync way?

I have read that generators, coming with ECMAScript 6 and already available in node.js dev version, will make easier to write async code in a sync way. But it was really hard to understand to me, how can we use generators to write async code ?
jillro
  • 3,960
  • 18
  • 26
0
votes
1 answer

In ES6, how do you get the name of the generator function inside the generator?

Using normal ECMAScript you can do something like, function f () { console.log(this.constructor.name); } new f() // outputs `f` However, a slight modification, function* f () { console.log(this.constructor.name); } var g = new f(); g.next() //…
user157251
  • 64,489
  • 38
  • 208
  • 350
0
votes
1 answer

In Node v.0.12, will there be any method to iterate over Map()?

If you create a Map() is there any method whatsoever to iterate over it? I know Node 0.12 isn't out yet, but 0.11.x is well on it's way and I can't figure it out in the devel branch, var m = new Map(); m.set('foo', 'bar'); Without knowing 'foo', is…
user157251
  • 64,489
  • 38
  • 208
  • 350
0
votes
1 answer

Harmony ES6 constructor types for Map vs Object?

How come when I create a Map it requires new and it is not required on an Object? var o = new Object(); var m = new Map(); var constructorObject = o.constructor; var constructorMap = m.constructor; var newObject = constructorObject(); var newMap =…
user157251
  • 64,489
  • 38
  • 208
  • 350
0
votes
1 answer

ES6 yield : what happens to the arguments of the first call next()?

Consider this snippet of code : function foo(a) { console.log("Mul =", a); return a * 2; }; function * process(start) { // next() #1 var result = start; console.log("Pre-processing =", result); result = yield foo(result); // next()…
Yanick Rochon
  • 45,203
  • 21
  • 112
  • 182
0
votes
1 answer

Syntax highlighting errors in PhpStorm 7.1

I got syntax highlighting errors in PhhpStorm when using the EcmaScript6 (harmony version) module syntax. When I use this code (to be sure its not a fault): https://github.com/stefanpenner/ember-app-kit-todos/blob/master/app/models/todo.js Then I…
DelphiLynx
  • 871
  • 1
  • 14
  • 39
0
votes
1 answer

In Draft ECMAScript 6, what's the rationale behind using StopIteration exception to signal the end of iteration?

In Draft ECMAScript 6 Specification, what's the rationale behind using StopIteration exception to signal the end of iteration instead of using a dedicated method (hasNext in Java/Scala, and MoveNext in C#) to check for the end of iteration.…
shengmin
  • 299
  • 1
  • 3
  • 12
0
votes
1 answer

Implement a javascript sandbox using new Harmony direct proxies

I found this gist to implement a sandbox for 3rd-party code using with and the Harmony direct proxies. How useful is it? Would it be possible to implement a proper javascript sandbox using proxies? What are the quirks and / or downsides of this…
janesconference
  • 6,045
  • 7
  • 52
  • 71
0
votes
1 answer

ES6: Public Symbols vs Private Symbols

I have been searching for discussions about how to specify a symbol as public or private in ECMAScript 6. As I undertand it, a private symbol would be created using a pattern similar to the following: var itemManager = (function() { var items =…
Nathan Wall
  • 9,698
  • 3
  • 22
  • 47
0
votes
1 answer

Es6: ability to call custom methods on set/update/delete of object properties?

I believe I've read that the upcoming ES6 definition enables calling custom definable methods when an object property is set, updated or deleted. However, I can't find the blogpost anymore to back that up. Is this correct? I believe this…
Geert-Jan
  • 16,760
  • 10
  • 68
  • 121
-1
votes
1 answer

Is it possible to use generators in node v0.12.0?

I thought node v0.12.0 would support generators but I cannot get it to work. Unfortunately, I haven't found any clear statements whether generator are supported or not. This is what I tried: # example.js "use strict"; function simpleGenerator(){ …
Philipp Claßen
  • 32,622
  • 19
  • 125
  • 194
-1
votes
3 answers

Compelling ECMAScript 6 Destructuring use cases

Why was destructuring introduced to ECMAScript 6?
Sam Leach
  • 12,076
  • 8
  • 39
  • 71
1 2 3
15
16