Message from JavaScript discussions
March 2018
— Yield or return should be contained within any block
When you need a generic serialization interface, you can use the iterator API with for/of and build polymorphic algorithms, too... it’s a standard for an interface all data structures should implement if possible
— I'm not telling anyone to avoid using iterators, just avoid for..of without return or yield
— You said it “implies side effects” which it does not, you have an idea that it is not possible to implement functional purity in that context, and I don’t know why this is
— I have seen many successful implementations using environment monads for instance, which exist just fine in a block without a return
— Show me a pure functional use case of for..of without return or yield in the loop body
— Maybe sometime I will
— Hah
— Until you do I'll keep having misconceptions
— I would if I wasn’t half asleep on my phone, kind of feel like you don’t want to find this yourself
— Or well, make it rather, as it isn’t that difficult with the right infrastructure in place
— I can't imagine it