what puts me off the Effect is all the fiddling with generator functions, which I find eminently unreadable and confusing. And for some reason unknown to me, despite the fact that the documentation itself indicates that pipelines can be used in the event of their unreadability, all the videos on Effect strangle these generators at every turn....
I see where you're coming from given generators have never been used in js/ts in the wild before. The reason we use them is because generators are extremely powerful, you simply need to mentally map "await" to "yield" and "async" to "gen" and it reads exactly like any other chunk of imperative code, including using native control flow such as switch/if/else/while/for. It really doesn't take much effort to be able to read it and write it, far less than actually using pipes. If you find it unreadable and prefer the pipe variant that's totally fine too, but just as the majority of folks prefer async/await over promise.then the majority of folks prefer generators over pipes.
@@stephenbluck2698 Maybe I haven't come across good materials explaining the idea behind generators and the practical problems they solve (because despite working commercially as a programmer, I've never even come across generators in production code). Are you able to recommend materials that you think give a good introduction to the topic of generators?
@@coder_one if you are aware of the problem that async/await solves for promises you are implicitly aware of the problem that generator solves for any other type which is not necessarily a promise as it is exactly the same thing (in fact async / await is a special case of a generator specialised to promise). The main idea is writing code in an imperative looking manner ("do this, do that, if this than that, etc") instead of being forced to write declarative code ("this.then(...).then(...)")
The benefits of them allowing to write in an imperative way while still maintaining the possible errors is great. You can code just like you do with async await but at the end your effect has the knowledge of all possible errors that could happen.
what puts me off the Effect is all the fiddling with generator functions, which I find eminently unreadable and confusing. And for some reason unknown to me, despite the fact that the documentation itself indicates that pipelines can be used in the event of their unreadability, all the videos on Effect strangle these generators at every turn....
I see where you're coming from given generators have never been used in js/ts in the wild before. The reason we use them is because generators are extremely powerful, you simply need to mentally map "await" to "yield" and "async" to "gen" and it reads exactly like any other chunk of imperative code, including using native control flow such as switch/if/else/while/for. It really doesn't take much effort to be able to read it and write it, far less than actually using pipes. If you find it unreadable and prefer the pipe variant that's totally fine too, but just as the majority of folks prefer async/await over promise.then the majority of folks prefer generators over pipes.
Honestly after working with generators for a bit, they actually become quite attractive!
@@stephenbluck2698 Maybe I haven't come across good materials explaining the idea behind generators and the practical problems they solve (because despite working commercially as a programmer, I've never even come across generators in production code).
Are you able to recommend materials that you think give a good introduction to the topic of generators?
@@coder_one if you are aware of the problem that async/await solves for promises you are implicitly aware of the problem that generator solves for any other type which is not necessarily a promise as it is exactly the same thing (in fact async / await is a special case of a generator specialised to promise). The main idea is writing code in an imperative looking manner ("do this, do that, if this than that, etc") instead of being forced to write declarative code ("this.then(...).then(...)")
The benefits of them allowing to write in an imperative way while still maintaining the possible errors is great. You can code just like you do with async await but at the end your effect has the knowledge of all possible errors that could happen.