Composable Control - lcompilers/lpython GitHub Wiki

This is a brainstorming page for candidate constructs for Continuations, Coroutines, Generators, and other forms of composable, non-local control to ASR. This is work-in-progress. No decisions have been made and no pilot implementations have been started as of 28 September 2022.

  • Continuations and Delimited Continuations --- Candidates for the lowest level: long known sufficient for implementing other abstractions of composable control. Exceptions are an instance of upward delimited continuations. Downward delimited continuations are functions that "jump" down a saved stack to partially completed computations.

  • goto --- still the best way to do some things like hand-written Finite-State Automata. These are demanded by users and all modern languages still support them in some way or another, even if only by delimited continuations.

  • Coroutines --- stackless, low-overhead invocation

  • Tail Recursion --- necessary for efficient recursive looping

  • Generators --- Enumerables dual to Observables in Rx, The Reactive Extensions