Here we go; this works; the controller sends commands to the engine, the engine executes those but depends on the state of the controller for the final result. there is a issue where the classes need to be defined above the actual code. This is no real issue when working with multiple files and public classes but I still think it's against the language specs. This is probably another example of the bug that creates a need for classes that extend Event to be defined above the spot where we use broadcast or signal on them.<br>
<br>Cheers,<br>Kas.<br><br>==========example code below================<br><br>//we need to define the classes at the top or the casting will fail<br>//I considder this to be a bug.<br><br>class Foo<br> {<br> fun void control( int message)<br>
{<br> }<br> <br> fun int querry ()<br> {<br> return false;<br> }<br> }<br><br>class Engine extends Foo<br> {<br> Foo controller;<br> <br> fun void control ( int message)<br>
{<br> <<<message + controller.querry()>>>;<br> }<br> }<br><br>class Controller extends Foo<br> {<br> Foo engine;<br> int state;<br> <br> spork ~ work();<br> <br>
fun int querry()<br> {<br> return state;<br> }<br> <br> fun void work()<br> {<br> while(1)<br> {<br> second => now;<br> !state => state;<br>
engine.control( maybe );<br> }<br> }<br> }<br><br><br>Controller boss;<br>Engine motor;<br>boss $ Foo @=> motor.controller;<br>motor $ Foo @=> boss.engine;<br><br>hour => now;<br>
<br>