3 ms·
i like them... a little too much. i keep abusing them more and more until every part of my program is a some sort of coroutine involved in an extremely elaborat
by keeganpoppen 3y ago
i like them... a little too much. i keep abusing them more and more until every part of my program is a some sort of coroutine involved in an extremely elaborate dance of having to remember to randomly next() to keep the return values from all the yield expressions in lockstep. you're not having fun until you're next()ing and .send()ing the same generator. or trying to remember how a trampoline works. and then you realize that you have a problem. one that even generators can't solve. xD
but like seriously sometimes i feel like they are just strictly better than functions. ok time to take my medication.
- iamcreasy 3y agoHow do you debug in a complex situation?
- keeganpoppen 3y agoa lot of coffee, wishing i had something even stronger xD. honestly, it is genuinely a situation where print debugging is your friend… i get every bit of code that yields in as close physical proximity as possible and trace it with my fingers like i’m a child counting on my fingers. because you really need to have an unassailable mental model in order for you to get it right at all most of the time (more so than “regular” programming). on the flip side, once you figure it out you never really need to touch it again, and you can usually “scale” the solution fairly easily as long as you don’t change the dynamics of the system (e.g. you can bring in N faux-coroutines in as long as only one pair is operating at once, but can’t as easily turn it from a two-person dance to a three person… i don’t know any three person dances lol).