Skip to content

How does the light-weight tail recursion work? #489

@iam

Description

@iam

There's a lot of classes in rx-scheduler.hpp like recursed_scope_type, recursed_scope, recursed, recursion, etc.

Is there some general principle tying these together?

Calling what(state->r.get_recurse()); seems to be the general pattern to invoke these, but even after reading the code in rx-scheduler.hpp it's hard to understand what the line of code is actually supposed to do?


Based off history like #2 I am guessing the intent was to eliminate virtual calls.

However it's not obvious how it's doing this, and why simply exhausting the entire queue in a single loop wasn't done instead?

   while (!q.empty()) { 
     auto what = q.pop();
     what();
   }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions