On 22.10.2025 19:24, John Bafford wrote:
* Aleksander Machniak brought up possibly merging suspend and delay. As you note, they are semantically different (delay for a specified time interval, vs. cooperatively yield execution for an unspecified time), and I think they should stay separate. If we're bikeshedding, I might rename suspend() to yield(), though that might not be possible with yield being a language keyword. That could be worked around if yield() was, say, a static method on Coroutine, so you would call Coroutine::yield() to yield the current coroutine. (That could also apply to isCancelled, so a particular coroutine would never need to have a reference to itself to check if cancellation is requested.)
Yeah, my first reaction was "suspend() does not sound right, it should be yield", but we indeed have yield already, so that might be confusing.
Why I wanted to get rid of delay()? Because "The delay function suspends the execution of a coroutine". So, to me it implies suspend. Am I right that it is essentially suspend() + usleep()?
-- Aleksander Machniak Kolab Groupware Developer [https://kolab.org] Roundcube Webmail Developer [https://roundcube.net] ---------------------------------------------------- PGP: 19359DC1 # Blog: https://kolabian.wordpress.com
