Another very nice and mind-bending presentation on coroutines, that eventually takes things so far that he creates a mini "OS" with coroutines as tasks, complete with system calls and a scheduler: http://dabeaz.com/coroutines/
The talk from David Mertz on Co-routines: https://www.youtube.com/watch?v=b7R3-_ViNxk
assert should only be used for debugging, and only for things that should never happen. side effects on assert is a no-no. (Also in C)