by Someone · 2y ago · 0 comments
Is it ever useful to be able to do something there before returning? If so, wouldn’t it be cleaner to implement this as an interface with two methods, one that simply has to yield for every item produced and an optional one that gets called when the runtime knows it won’t ever run the first one anymore?
Also there are many cases where you might need to have some special logic after the last iteration, so simply killing the underlying function is not an option.