No secret sauce, just having the pleasure of chosing multiple backends, including an interpreter.
Bytecode runtime during workflow, optimized native AOT for release and final production tests.
A much better design is to do it lazily which is possible if you can store closures as fields of a data structure.
Not sure what fast compilation and execution or dependencies has to do with this. Implementing iterators that way is the worst possible solution that results in slow execution that can blow up the stack and crash a program. It would be better not to have iterators at all than to require them to be eagerly evaluated.
You can support functional features without being a Haskell...
Sending data through channels just to implement an iterator seems insane. It's not strictly lazy either...
Why do go developers reject simple patterns that make faster code?
Look, I’ve written lots of scala and erlang so I get your argument. It just does not exist in go. And that’s okay.
Never got caught thinking “gee, need a lazy collection”. Maybe a stream when reading stuff from the ether. In go, channel was enough. 5 minute job. Nothing insane.
for over a channel is in essence lazy. Channel stores the data as a linked list. So what’s the benefit.
Lazy evaluation is the only reasonable way to implement iterators so you don't have to pay the costs of intermediate data structures or sending data over channels. Insertion into a data structure isn't free. Function composition is.
For loops may be unfashionable but they aren’t hard to read.
I do find deeply nested for loops with outer variables that might start uninitialized or need to be mutable much more difficult to read.
The final generics design is probably not expressive enough to do it ergonomically in user code neither (building something where the intermediates are a library type with a last `.something()` call to collect a final []T).