module Novika::Schedulable::ShouldOpenWhenScheduled

Overview

The includer should be a Form.

If the scheduled stack is the same as the active stack, the includer form is simply opened (see Form#on_open) without any kind of scheduling or waiting for the engine to pick it up.

However, if the scheduled stack is different from the active stack, things get just a bit more difficult.

Namely, a fictious block holding this form is created, and scheduled "as normal". Then, this form is also simply opened.

Note that we do not set the fictious block's cursor to 0. This handles the following two things.

First, the engine won't try to open the includer form again on the next interpreter loop cycle (remember we already called Form#on_open on it).

Second, if form schedules something else, all will work as expected: first, this something will run, and then all that's above, again, without re-running the includer form because the cursor is past it.

Direct including types

Defined in:

novika/forms/form.cr

Instance Method Summary

Instance Method Detail

def schedule!(engine : Engine, stack : Block) #