4 ms·
Ruby has "yield" which, while possible to replicate in Obj-C, it's not nearly as nice. Also, Ruby can yield arguments, and the block being yielded to is free to
by jballanc 15y ago
Ruby has "yield" which, while possible to replicate in Obj-C, it's not nearly as nice. Also, Ruby can yield arguments, and the block being yielded to is free to ignore those arguments. That's the sort of flexibility that can make Ruby so much more enjoyable to work with in high-level code.
- 286c8cb04bda 15y agoThat's a great example, thanks! I did some looking, and I found a few[1] examples[2] of coroutines in Objective-C, though none of them seemed fully fleshed-out. Even if they were, none were, as you say, nearly as nice as "yield". [1]: http://cocoadev.com/wiki/CSCoroutineTest http://cocoadev.com/wiki/CSCoroutineTest [2]: https://gist.github.com/1033477 https://gist.github.com/1033477