About generators

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

About generators

Mohan.Radhakrishnan

Hi,

        I have used simple generators but there seem to be some advanced usages.  I came across these git references from another post and I have looked at the code. What are some articles that explain these concepts for JS developers before delving into this type of code ? Is reading this code the only way ?

 

https://github.com/spion/genny 

https://github.com/creationix/gen-run

https://github.com/tj/co

https://github.com/jmar777/suspend

 

 

Thanks,

Mohan

 

 

 

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

RE: About generators

Aaron Powell

I’ve done a few blog posts on the topic:

http://www.aaron-powell.com/posts/2014-01-13-functions-that-yield-mutliple-times.html

http://www.aaron-powell.com/posts/2014-01-18-calling-up-callbacks-with-yield.html

http://www.aaron-powell.com/posts/2014-01-28-cleaning-up-promises-wit-yield.html

 

Axel has blogged about them too - http://www.2ality.com/2013/06/iterators-generators.html

 

 

From: es-discuss [mailto:[hidden email]] On Behalf Of [hidden email]
Sent: Thursday, 14 May 2015 4:10 PM
To: [hidden email]
Subject: About generators

 

Hi,

        I have used simple generators but there seem to be some advanced usages.  I came across these git references from another post and I have looked at the code. What are some articles that explain these concepts for JS developers before delving into this type of code ? Is reading this code the only way ?

 

https://github.com/spion/genny 

https://github.com/creationix/gen-run

https://github.com/tj/co

https://github.com/jmar777/suspend

 

 

Thanks,

Mohan

 

 

 

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.


_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

RE: About generators

Mohan.Radhakrishnan

Thanks. What is the underlying concurrency framework when we use generators for concurrent workloads ? Does it depend on the particular VM ?

 

Mohan

 

From: Aaron Powell [mailto:[hidden email]]
Sent: Thursday, May 14, 2015 12:00 PM
To: Radhakrishnan, Mohan (Cognizant); [hidden email]
Subject: RE: About generators

 

I’ve done a few blog posts on the topic:

http://www.aaron-powell.com/posts/2014-01-13-functions-that-yield-mutliple-times.html

http://www.aaron-powell.com/posts/2014-01-18-calling-up-callbacks-with-yield.html

http://www.aaron-powell.com/posts/2014-01-28-cleaning-up-promises-wit-yield.html

 

Axel has blogged about them too - http://www.2ality.com/2013/06/iterators-generators.html

 

 

From: es-discuss [[hidden email]] On Behalf Of [hidden email]
Sent: Thursday, 14 May 2015 4:10 PM
To: [hidden email]
Subject: About generators

 

Hi,

        I have used simple generators but there seem to be some advanced usages.  I came across these git references from another post and I have looked at the code. What are some articles that explain these concepts for JS developers before delving into this type of code ? Is reading this code the only way ?

 

https://github.com/spion/genny 

https://github.com/creationix/gen-run

https://github.com/tj/co

https://github.com/jmar777/suspend

 

 

Thanks,

Mohan

 

 

 

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

RE: About generators

Mohan.Radhakrishnan
In reply to this post by Aaron Powell

This is interesting too.

http://syzygy.st/javascript-coroutines/

http://www.dabeaz.com/coroutines/Coroutines.pdf

 

Mohan

 

From: Aaron Powell [mailto:[hidden email]]
Sent: Thursday, May 14, 2015 12:00 PM
To: Radhakrishnan, Mohan (Cognizant); [hidden email]
Subject: RE: About generators

 

I’ve done a few blog posts on the topic:

http://www.aaron-powell.com/posts/2014-01-13-functions-that-yield-mutliple-times.html

http://www.aaron-powell.com/posts/2014-01-18-calling-up-callbacks-with-yield.html

http://www.aaron-powell.com/posts/2014-01-28-cleaning-up-promises-wit-yield.html

 

Axel has blogged about them too - http://www.2ality.com/2013/06/iterators-generators.html

 

 

From: es-discuss [[hidden email]] On Behalf Of [hidden email]
Sent: Thursday, 14 May 2015 4:10 PM
To: [hidden email]
Subject: About generators

 

Hi,

        I have used simple generators but there seem to be some advanced usages.  I came across these git references from another post and I have looked at the code. What are some articles that explain these concepts for JS developers before delving into this type of code ? Is reading this code the only way ?

 

https://github.com/spion/genny 

https://github.com/creationix/gen-run

https://github.com/tj/co

https://github.com/jmar777/suspend

 

 

Thanks,

Mohan

 

 

 

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.

This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: About generators

Axel Rauschmayer
In reply to this post by Aaron Powell
Thanks Aaron! The longer version of that blog post is here: http://www.2ality.com/2015/03/es6-generators.html

On 14 May 2015, at 08:30, Aaron Powell <[hidden email]> wrote:

I’ve done a few blog posts on the topic:
 
 
From: es-discuss [[hidden email]] On Behalf Of [hidden email]
Sent: Thursday, 14 May 2015 4:10 PM
To: [hidden email]
Subject: About generators
 
Hi,
        I have used simple generators but there seem to be some advanced usages.  I came across these git references from another post and I have looked at the code. What are some articles that explain these concepts for JS developers before delving into this type of code ? Is reading this code the only way ?
 

https://github.com/spion/genny 

https://github.com/creationix/gen-run

https://github.com/tj/co

https://github.com/jmar777/suspend

 
 
Thanks,
Mohan
 
 
 
This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful. Where permitted by applicable law, this e-mail and other e-mail communications sent to and from Cognizant e-mail addresses may be monitored.
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss

-- 
Dr. Axel Rauschmayer
[hidden email]
rauschma.de




_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: About generators

Jason Orendorff
In reply to this post by Mohan.Radhakrishnan
On Thu, May 14, 2015 at 2:05 AM,  <[hidden email]> wrote:
> Thanks. What is the underlying concurrency framework when we use generators
> for concurrent workloads ? Does it depend on the particular VM ?

Generators aren't for concurrency.

When a generator runs, it runs in the same thread as the caller. The
order of execution is sequential and deterministic, and never
concurrent. Unlike system threads, a generator is only ever suspended
at points marked by yield in its body.

(copied from <https://hacks.mozilla.org/2015/05/es6-in-depth-generators/>)

-j
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss
Reply | Threaded
Open this post in threaded view
|

Re: About generators

Jeremy Martin
Hey (author of suspend here): this post was an earlier attempt I had an explaining some of the concepts involved: http://devsmash.com/blog/whats-the-big-deal-with-generators

It covers some of the basics, like, what iterators are, how generators relate to iterators, how generators enable "suspended" execution within the context of run-to-completion semantics; etc. Hope it helps!

On Thu, May 14, 2015 at 10:47 AM, Jason Orendorff <[hidden email]> wrote:
On Thu, May 14, 2015 at 2:05 AM,  <[hidden email]> wrote:
> Thanks. What is the underlying concurrency framework when we use generators
> for concurrent workloads ? Does it depend on the particular VM ?

Generators aren't for concurrency.

When a generator runs, it runs in the same thread as the caller. The
order of execution is sequential and deterministic, and never
concurrent. Unlike system threads, a generator is only ever suspended
at points marked by yield in its body.

(copied from <https://hacks.mozilla.org/2015/05/es6-in-depth-generators/>)

-j
_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss



--
Jeremy Martin
661.312.3853
@jmar777

_______________________________________________
es-discuss mailing list
[hidden email]
https://mail.mozilla.org/listinfo/es-discuss