I just noticed that roMessagePort implements ifEnum and i wonder what the fruits of this are. Under ifEnum, here is what it can do:
Reset()
dynamic Next()
bool IsNext()
bool IsEmpty()
port.isEmpty() i can imagine useful to check if there are any events waiting, instead of wait(port, 1) - with the bonus that it won't yank the event from the queue.
port.isNext() on the other hand seems funky, because it is hopeless optimist and always returns "true", no matter if there is event or not. Funky because in this way isNext() != not isEmpty(). I imagine this was made so that one can do FOR EACH msg IN port - and the loop does not exit when there are no pending messages.
port.next() seems to do exactly what
port.waitMessage(0) does.
What does
port.reset() do though, i wonder. The semantic is not apparent to me. Does it flush out all queued events? FWIW, i don't even know if message port does queue more than 1 event or does it keep only the last one? (PS. did small experiment and: yes, events get queued. no, reset() does not flush the queue)
Can someone shed light on my musings pls?