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 discussed:
>> https://github.com/**rwldrn/tc39-notes/blob/master/**
>> es6/2013-01/jan-31.md#**comprehensionsgenerator-syntax<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 getURLs()) xhrGet(url)]
>>
>> ?
>>
>> On Tuesday, July 16, 2013 7:38:56 PM UTC-4, Rick Waldron wrote:
>>>
>>>
>>>
>>>
>>> On Tue, Jul 16, 2013 at 9:13 AM, jmar777 <jma...@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 lot nicer at the language level (rather than relying on cludgy
>>>> `suspend.map()` or whatever helpers).
>>>>
>>>> Here's an example from the ES6 Wiki [1]:
>>>>
>>>>     (xhrGet(url) for (url of getURLs())) // hawt
>>>>
>>>> [1] http://wiki.ecmascript.org/**doku.php?id=harmony:generator_**
>>>> expressions<http://wiki.ecmascript.org/doku.php?id=harmony:generator_expressions>
>>>>
>>>
>>> Caution!!!
>>>
>>> *"This proposal has progressed to the Draft ECMAScript 6 Specification,
>>> which is available for review here: specification_drafts. Any new issues
>>> relating to them should be filed as bugs at http://bugs.ecmascript.org.
>>> The content on this page is for historic record only and may no longer
>>> reflect the current state of the feature described within"*
>>>
>>> I added this to every wiki proposal that is now in the spec—in this
>>> case, the generator expression syntax is backwards!
>>>
>>> In the spec draft...
>>>
>>> GeneratorComprehension :
>>>   ( Comprehension )
>>>
>>>
>>> And Comprehension is defined in ArrayComprehension
>>>
>>> Comprehension :
>>>   ComprehensionFor ComprehensionQualifierTail
>>>
>>> ComprehensionQualifierTail :
>>>   AssignmentExpression
>>>   ComprehensionQualifier ComprehensionQualifierTail
>>>
>>> ComprehensionQualifier :
>>>   ComprehensionFor
>>>   ComprehensionIf
>>>
>>> ComprehensionFor :
>>>   for (ForBinding of AssignmentExpression )
>>>
>>> ComprehensionIf :
>>>   if ( AssignmentExpression )
>>>
>>>
>>> ForBinding :
>>>   BindingIdentifier
>>>   BindingPattern
>>>
>>>
>>> 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<https://github.com/rwldrn/tc39-notes/blob/master/es6/2013-01/jan-31.md#comprehensionsgenerator-syntax>
>>>
>>>
>>> Rick
>>>
>>>
>>>
>>>
>>>> On Tuesday, July 16, 2013 2:36:44 AM UTC-4, cpprototypes wrote:
>>>>>
>>>>> 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 UTC-7, cpprototypes wrote:
>>>>>>
>>>>>> I'm using node 0.11.3 with --harmony-generators to try the new
>>>>>> feature.  I found two libraries that should help use existing node
>>>>>> callback-based code with generators (suspend and galaxy).  The code I'm
>>>>>> trying to run was similar to the following:
>>>>>>
>>>>>> (using suspend)
>>>>>>
>>>>>> var fs = require('fs');
>>>>>> var request = require('request');
>>>>>>
>>>>>> suspend(function* (resume) {
>>>>>>     var contents = yield fs.readFile('idList.json', 'utf8', resume);
>>>>>>     contents.split('\n').forEach(**f**unction(id) {
>>>>>>         var info = yield request.get('http://www.**exampl**
>>>>>> e.com?id='+id <http://www.example.com?id='+id>, resume);
>>>>>>     });
>>>>>> })();
>>>>>>
>>>>>> (using galaxy)
>>>>>>
>>>>>> var galaxy = require('galaxy');
>>>>>> var fs = galaxy.star(require('fs'));
>>>>>> var request = galaxy.star(require('request')****);
>>>>>>
>>>>>> function* main() {
>>>>>>     var contents = yield fs.readFile('idList.json', 'utf8');
>>>>>>     contents.split('\n').forEach(**f**unction(id) {
>>>>>>         var info = yield request.get('http://www.**exampl**
>>>>>> e.com?id='+id <http://www.example.com?id='+id>);
>>>>>>     });
>>>>>> };
>>>>>>
>>>>>> galaxy.unstar(main)(function(**e**rr, result) {
>>>>>>     console.log('done');
>>>>>> });
>>>>>>
>>>>>> Using either library, when node tries to execute the get request
>>>>>> ("var info = yield request.get...") it exits with the following error:
>>>>>>
>>>>>> SyntaxError: Unexpected identifier
>>>>>>
>>>>>> And the error highlights the "request" part in "var info = yield
>>>>>> request.get..."  I'm guessing that the creation of the new function scope
>>>>>> in the forEach is somehow causing an issue.  But I'm not sure why it's 
>>>>>> not
>>>>>> working.
>>>>>>
>>>>>>
>>>>>>  --
>>>> --
>>>> Job Board: http://jobs.nodejs.org/
>>>> Posting guidelines: https://github.com/joyent/**node/wiki/Mailing-List-
>>>> **Posting-Guidelines<https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines>
>>>> You received this message because you are subscribed to the Google
>>>> Groups "nodejs" group.
>>>> To post to this group, send email to nod...@googlegroups.com
>>>> To unsubscribe from this group, send email to
>>>> nodejs+un...@googlegroups.com
>>>> For more options, visit this group at
>>>> http://groups.google.com/**group/nodejs?hl=en?hl=en<http://groups.google.com/group/nodejs?hl=en?hl=en>
>>>>
>>>> ---
>>>> You received this message because you are subscribed to the Google
>>>> Groups "nodejs" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to nodejs+un...@googlegroups.com.
>>>> For more options, visit 
>>>> https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
>>>> .
>>>>
>>>>
>>>>
>>>
>>>  --
> --
> Job Board: http://jobs.nodejs.org/
> Posting guidelines:
> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
> You received this message because you are subscribed to the Google
> Groups "nodejs" group.
> To post to this group, send email to nodejs@googlegroups.com
> To unsubscribe from this group, send email to
> nodejs+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/nodejs?hl=en?hl=en
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nodejs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nodejs+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to nodejs@googlegroups.com
To unsubscribe from this group, send email to
nodejs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nodejs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to