Is dynamic condition handling allowed?
PseuCo, syntactically, allows you to use expressions in waitForCondition
and signal
:
monitor Test {
condition c1 with (true);
condition c2 with (false);
void do(bool it) {
waitForCondition(it ? c1 : c2);
signal(!it ? c1 : c2);
}
}
Similarly, conditions can be reassigned:
monitor Test {
condition c1 with (true);
condition c2 with (false);
void do(bool it) {
c2 = c1;
waitForCondition(c2);
}
}
mainAgent {
Test t;
t.do(true);
println("it");
}
I think it's also clear how that should behave. However, neither the CCS-based nor the Petri-net-based compilers support this right now. (Both compilers crash for both programs, except the CCS-based compiler with the second program, which silently ignores the assignment.) I could implement this, but it's somewhat annoying and would blow up the nets. (Background: waitForCondition
basically is a procedure call for me, and allowing the would require dynamic dispatch of procedure calls.)
Also note that even if we keep allowing this, conditions cannot be sent in channels, passed to procedures, or returned from procedures.
Do we want to allow this (and implement it), or do we want to disallow this (and reject it in the parser)?