Course LUA Symmetric and Asymmetric Coroutines

Extrait du course LUA Symmetric and Asymmetric Coroutines

Coroutines
-An unconventional, but quite powerful control mechanism
-Well known as an abstract concept, but with several variations
-Variations with big differences
 Kinds of Coroutines
-Symmetric or asymmetric
-Stackful
-First-class values
Symmetric and Asymmetric Coroutines
-Symmetric coroutines: one primitive for transfering control
-Typically called transfer
-Asymmetric coroutines: two primitives for  transferring control
** Typically called resume and yield
resume/yield ↔ call/return
transfer     ↔ goto
Stackful Coroutines
Non-stackful coroutines can be suspended only inside the body of the original function
Original concept (co-routine x sub-routine)
Stackful coroutines can be suspended while calling other functions
As implemented in Modula
Similar to cooperative multithreading
First-class Coroutines
Coroutines can be represented by first-class values
can be resumed anywhere in a program
Restricted forms of coroutines are not first class
e.g., generators in CLU and other languages

………
Si le lien ne fonctionne pas correctement, veuillez nous contacter (mentionner le lien dans votre message)
Course LUA Symmetric and Asymmetric Coroutines (116 Ko) (Cours PDF)
Symmetric and Asymmetric Coroutines

Télécharger aussi :

Laisser un commentaire

Votre adresse de messagerie ne sera pas publiée. Les champs obligatoires sont indiqués avec *