and the pattern library is built entirely around embedding in streams and yielding others streams. it uses this for very interesting numeric music patterns.
result = yield from future – suspends the coroutine until the future is done, then returns the future’s result, or raises an exception, which will be propagated. (If the future is cancelled, it will raise a CancelledError exception.) Note that tasks are futures, and everything said about futures also applies to tasks.
result = yield from coroutine – wait for another coroutine to produce a result (or raise an exception, which will be propagated). The coroutine expression must be a call to another coroutine.
I realized this limitation one day while trying to do it in python. You cannot just yield another stream.
SuperCollider has proper co-routines: http://danielnouri.org/docs/SuperColliderHelp/Core/Kernel/Ro...
and the pattern library is built entirely around embedding in streams and yielding others streams. it uses this for very interesting numeric music patterns.
Python 3.4 also now has co-routines: https://docs.python.org/3.4/library/asyncio-task.html
esp this is interesting:
result = yield from future – suspends the coroutine until the future is done, then returns the future’s result, or raises an exception, which will be propagated. (If the future is cancelled, it will raise a CancelledError exception.) Note that tasks are futures, and everything said about futures also applies to tasks.
result = yield from coroutine – wait for another coroutine to produce a result (or raise an exception, which will be propagated). The coroutine expression must be a call to another coroutine.
Javascript does/will have simple generators