Note that there are some explanatory texts on larger screens.

plurals
  1. POReal-world usage of Lua co-routines/continuation serialization to simplify async logic?
    primarykey
    data
    text
    <p>The <a href="http://lua-users.org/wiki/PlutoLibrary" rel="noreferrer">Pluto library</a> for <a href="http://www.lua.org/about.html" rel="noreferrer">Lua</a> claims to be able to serialize Lua co-routines. I interpret this as meaning 'serializeable continuations', which is an important feature for making asyncronous programming writeable in a syncronous style.</p> <p>For example, a workflow can be expressed linearly instead of requiring named entry points</p> <pre><code>if (ask user is hungry) then if (not ask user is vegetarian) then if (ask user if likes_burgers) then feed_user(burger) else tell_user("Picky!") else feed_user(salad) </code></pre> <p>instead of</p> <pre><code>function main() ask(user is hungry, "hungry_response") function hungry_response(answer) if (answer is yes) ask(user is vegetarian, "vegetarian_response") function vegetarian_response(answer) if (answer is yes) feed_user(salad) else ask(user likes burgers, "burgers_response") function burgers_response(answer) if (answer is yes) then feed_user(burger) else tell_user("Picky!") </code></pre> <p>While if statements translated into the previous style aren't bad, things get very complicated once you involve local variables, loops, nested function calls, etc.</p> <p>This is where serializeable continuations become critically important.</p> <p><a href="http://www.baum.com.au/~jiri/ae/blog/01102082319" rel="noreferrer">Serialized continuations</a> are used in JavaFlow, Cocoon (Rhink), Seaside, PLT Scheme, SICS, and are great for dealing with business workflows, medical diagnostics, and (in my case), textual adventure games. </p> <p><strong>Are there any examples (hopefully open source!) of Lua and Pluto leveraging their features in this way, using continuations to simplify logic in an async environment?</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload