3 ms·
Not quite, since with resumable generators you can resume at any later point in the program, while here "return" must be lexically scoped to the handler (wherea
by int_19h 2y ago
Not quite, since with resumable generators you can resume at any later point in the program, while here "return" must be lexically scoped to the handler (whereas in e.g. Python you can call next() wherever).
This is really more like passing a callback through a side channel. "toss" is invoking said callback, and "return" is, well, returning from it.