gumil
07/18/2020, 11:04 AMyield
in production code? I rarely see it being used and only seen it used in tests. I wanted to know people's opinion if they ever used this function.dekans
07/18/2020, 12:31 PMgumil
07/18/2020, 12:36 PMFlowState
it only emits the last value without the yield.Zach Klippenstein (he/him) [MOD]
07/19/2020, 10:12 PMyield()
call fixes something and you’re not sure why, it’s dangerous to rely on that without figuring out what’s really going on. Adding it to production code in to make your tests work is definitely something I would consider a smell.
In your example, it sounds like you’re trying to observe intermediate values in a sequence of state transitions, which is an odd thing to test since your production code is probably just as likely to not observe intermediate values.gumil
07/19/2020, 10:38 PM