phasemachines: a better way of writing callback code (TCL)

Before After
proc test { name } {
    after 1000 test2 passed $name
}
proc test2 { str name } {
    puts "$str $name"
}

test danny
vwait done
phasemachine test { name } {
    after 1000 [phase_next_cb] passed
} { str } {
    puts "$str $name"
    phase_exit
}

test danny
vwait done

The idea behind the phasemachine is that you can write callback driven code much easier. Phasemachine enabled code is significantly easier to manage than a mess of free floating functions.

Features of phasemachine driven include:



Download the source here

Back.