-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get rid of perform()
#3
Comments
If you're concerned about losing the benefits of effect above the calls to perform(), I don't understand why you'd suggest making Effect.init do the performance -- this would make all code that creates an Effect not purely functional. I understand that while migrating a codebase from deferreds (or any kind of IO) to effect will require putting a call to perform() call at every boundary, eventually the number of these calls should be reduced as more and more of your code becomes purely functional. perform() is a necessary part of separating pure and impure code, being the line of demarcation between them, which is intrinsic to the whole point of the effect library. |
Running code is always side-effecty (and therefore by definition non-functional) when it's running; a program without side effects is useless. I want my code to be easy to reason about and test when I am writing the code. My strawman proposal would allow making code functional when testing. For running code, does it really matter if (Certainly if you're writing Haskell and you've got a compiler that can take advantage of functional code for parallelism or STM or whatever then that's great... but this is Python.) |
And to clarify, I'm worried about losing the benefits to unit testing because of |
so, I'm willing to humor this conversation somewhat, but I will point out the description of the Effect project:
If you're not interested in writing purely functional code, then I don't think Effect is what you want. I made it the one-line description of this project for a reason :) |
I feel like calling
perform()
in non-test code is a problem, insofar as you have to call it at arbitrary points in the code, and beyond those boundaries the benefits go away.A hand-wavy counter-proposal:
perform()
is done automatically inEffect.__init__
... except when disabled by running code in awith no_effect:
context manager, in which case the current API applies.The text was updated successfully, but these errors were encountered: