-
I faced the same issue when migrating genesis from code generation to generics. Before it used to have the same streaming API as you describe but now I decided to go with functional API. That means, you basically "pipe" data with temporary variables. So your last example would look something like this:
-
CodeRabbit
CodeRabbit: AI Code Reviews for Developers. Revolutionize your code reviews with AI. CodeRabbit offers PR summaries, code walkthroughs, 1-click suggestions, and AST-based analysis. Boost productivity and code quality across all major languages with each PR.
-
Yes, it requires you to come up with more variable names but it doesn't make code much longer or less readable. The proposal add elixir-like pipe operator has a long discussion on the subject. That said, I'm still trying to figure out if it is possible to implement with generics some kind of pipe or lenses.
-
iter
Experimental lazy iterator library to test the capabilities of go generics in 1.18 (by urandom)
Came to pretty similar conclusions regarding the ergonomics myself: https://github.com/urandom/iter/blob/main/README.md