Skip to content

Instantly share code, notes, and snippets.

@kbilsted
Last active November 13, 2022 00:38
Star You must be signed in to star a gist
Embed
What would you like to do?
@kbilsted
Copy link
Author

@maletor thanks, essentially you just removed the ability to throw an exception one place and catch in another by marking it an explicit codepath which you need to cater for all the way from your catch-statement down to your throw statement.

@kbilsted
Copy link
Author

should we convert part of this debate into text somehow? Should I convert this gist to a repo so we can grow this resource together?

@olleharstedt
Copy link

(You also get concurrency for free with generators - by yielding an array of promises: https://amphp.org/)

@olleharstedt
Copy link

(And another aspect with effects-as-promises is that you can mock the effects instead of the dependencies when designing your tests. The downside being that you bind the test more tightly to your implementation. But there are several upsides as well - e.g. testing only certain types of effects, being able to ignore all effects, and less mocking code.)

@olleharstedt
Copy link

should we convert part of this debate into text somehow? Should I convert this gist to a repo so we can grow this resource together?

Dunno. The pattern would have to be tried out in a bigger application, I think, before knowing if it's applicable.

@olleharstedt
Copy link

Oh, you already made a repo. Nice. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment