- View SourceI really love coroutines, especially for handling functions that have
wait states or delays. But is it possible to have implicit
coroutines, that only appear when you use "yield"? For example,
Object wait = method(sec, Timer addEvent(sec, self resume))
fireWeapon := method(fire; wait(0.5); crouch;)
Now instead of calling "actor @@start", wait would turn the object
into a coroutine. Implicitly creating coros this way eliminates the
notion of threads/coroutines, etc. You just code.
I guess this is going toward actors, but without the inefficiency if
you don't need every object to be asynchronous.