Here are the notes from the meeting when this was discussed:
https://github.com/rwldrn/tc39-notes/blob/master/es6/2013-01/jan-31.md#comprehensionsgenerator-syntax
Ahh, thanks for the clarification. So, hopefully correct this time, the
previous example should have really been:
[for (url of
Also, FWIW, the LTR version reads much more naturally to me. Happy about
that change.
On Wednesday, July 17, 2013 8:42:40 AM UTC-4, jmar777 wrote:
Here are the notes from the meeting when this was discussed:
On Wed, Jul 17, 2013 at 8:42 AM, jmar777 jmar...@gmail.com wrote:
Here are the notes from the meeting when this was discussed:
https://github.com/**rwldrn/tc39-notes/blob/master/**
On Wed, Jul 17, 2013 at 8:43 AM, jmar777 jmar...@gmail.com wrote:
Also, FWIW, the LTR version reads much more naturally to me. Happy about
that change.
Same here :)
On Wednesday, July 17, 2013 8:42:40 AM UTC-4, jmar777 wrote:
Here are the notes from the meeting when this was
The code sample I posted was a simplified example to demonstrate the
issue. The actual command line script I was working on uses the response
from the get request for other things. That for...of syntax is very nice,
is it an official part of ECMAScript 6?
On Friday, July 12, 2013 2:47:28 PM
That for...of syntax is very nice, is it an official part of ECMAScript 6?
Yes, although it's not implemented in V8 just yet. Once for-of and
generator-expressions are implemented, a lot of these operations will
become a lot nicer at the language level (rather than relying on cludgy
Yes, although it's not implemented in V8 just yet.
I was wrong (and happy about it)! This is working in the latest unstable
version of node/v8:
$ node -e 'console.log(process.versions.v8)'
3.20.2
$ node --harmony-iteration --harmony-generators
function* gen() { yield 'foo'; yield 'bar'; }
On Tue, Jul 16, 2013 at 2:36 AM, cpprototypes cpprototy...@gmail.comwrote:
The code sample I posted was a simplified example to demonstrate the
issue. The actual command line script I was working on uses the response
from the get request for other things. That for...of syntax is very nice,
On Tue, Jul 16, 2013 at 9:13 AM, jmar777 jmar...@gmail.com wrote:
That for...of syntax is very nice, is it an official part of ECMAScript
6?
Yes, although it's not implemented in V8 just yet. Once for-of and
generator-expressions are implemented, a lot of these operations will
become a
Thanks for the replies, I have a better understanding now of how these
libraries are using generators. I hope that one of these types of
libraries becomes as popular as the async library and standard within the
node community. This way of writing async code is much more elegant than
the
I'm so glad to see more interest in using generators in node.js. I've
experimented with this style of programming a *lot*. I even went so far as
to re-implement node.js in the lua language (luvit.io) and attempted to
implement it on top of SpiderMonkey (luvmonkey) because both VMs already
have
The fact that you can't trivially do deep yields in callbacks is a good
thing.
For example
```
contents.split('\n').forEach(function(id) {
var info = yield
request.get('http://www.example.com?id='+idhttp://www.example.com/?id='+id,
resume);
});
```
Would have done N get request in series
This is probably true (although I'm currently arguing for them anyway in
es-discuss :)).
Regarding the suspend example, I keep running into this same problem
myself, and the nested generators are just too clunky to work with for such
common interactions. Expect some helper functions in the
Parallelizing is not very difficult. Galaxy gives you two ways to do it.
The first one is to call galaxy.spin. This gives you another generator
function on which you can yield later to get the result. This is very much
like a future.
var future = galaxy.spin(generatorFunction(args));
// do
Hey -
Just realized there's another simple solution to your issue (that should
work with any of the libraries mentioned in this thread) - just avoid
nested functions:
suspend(function* (resume) {
var contents = yield fs.readFile('idList.json', 'utf8', resume),
ids =
On Mon, Jul 15, 2013 at 7:17 PM, jmar777 jmar...@gmail.com wrote:
Hey -
Just realized there's another simple solution to your issue (that should
work with any of the libraries mentioned in this thread) - just avoid
nested functions:
suspend(function* (resume) {
var contents = yield
yield is only valid inside a function*. This is why galaxy has a 'Star'
variant for all the array methods that take a callback. So, it should work
if you replace forEach by forEachStar
Bruno
On Friday, July 12, 2013 11:47:28 PM UTC+2, cpprototypes wrote:
I'm using node 0.11.3 with
I responded a bit too quickly. To make it work with galaxy you need to
change the following:
* forEach - forEachStar
* function(id) - function*(id) for the callback
* add a yield to the forEachStar call (this is a function* so you need to
yield on it)
This will get you started but you will hit
I just published a new version (0.1.3) that makes it easier to deal with
mulitple results callback. You don't need to write a wrapper any more; you
just get the resutls as an array. So your example becomes:
var galaxy = require('galaxy');
var fs = galaxy.star(require('fs'));
var get =
19 matches
Mail list logo