I have tried that now and replaced sleep with yield in the test. The argument of predicate yield/1 has type timeout. When I stepped through the code with the debugger, I observed that the presentation of timeout values looked a bit unusual. Below I tried to set up an alternative timeout presenter:
Code: Select all
open core, presenter
domains
myTimeout = timeout [presenter(presenter_myTimeout)].
clauses
run() :-
%Timeout = infinite,
Timeout = timeoutAfter(hasDomain(durationValue, 1 * oneHour + 2 * oneMinute + 3 * oneSecond)),
%Timeout = timeoutAt(time::newGMT(2024, 11, 6, 1, 2, 3):gmtTimeValue),
%
MyTimeout = uncheckedConvert(myTimeout, Timeout),
stdIO::present(Timeout),
stdIO::nl(),
stdIO::present(MyTimeout),
stdIO::nl().
class predicates
presenter_myTimeout : presenter::presenter{myTimeout}.
clauses
presenter_myTimeout(T) = P :-
T = infinite,
P = mkPresenter_fixed(fp_string("infinite"), presenter::mkFP_childOnly_term("Representation", uncheckedConvert(integer64, T)))
orelse
if T <= 0 then
P =
enclose("after(", ")",
mkPresenter_fixed(mkFP_pres("After", { = presenter_durationValue(uncheckedConvert(core::durationValue, -T)) }),
presenter::mkFP_childOnly_term("Representation", uncheckedConvert(integer64, T))))
else
P =
enclose("at(", ")",
mkPresenter_fixed(mkFP_pres("At", { = presenter_gmtTimeValue(convert(core::gmtTimeValue, T)) }),
presenter::mkFP_childOnly_term("Representation", uncheckedConvert(integer64, T))))
end if.