Skip to content
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

capture of side effects #1

Open
moodymudskipper opened this issue Sep 13, 2021 · 0 comments
Open

capture of side effects #1

moodymudskipper opened this issue Sep 13, 2021 · 0 comments

Comments

@moodymudskipper
Copy link
Owner

If I get around making {captor} work decently we can capture some side effects.

Some side effects should just make the function fail, warning that some side effects are not compatible with {refactor}, such as deleting files for example.

Some side effects could in principle be captured and silenced in original code, and captured but not silenced in refactored code. This includes printed output, messages, warnings, errors... It might be tricky though, if capture.output() is used for example it should capture something even if the output was silenced.

Maybe for the above example we can silence, capture and compare with, a combination of try, capture.output, and options(warn = 1)(so we can capture warnings with capture.output too). And then rethrow what was captured. Or we design our own capture.output variant that captures AND prints to console (if relevant), which we use on refactored code.

It might be that every compromise comes with corner cases though... so maybe these could be mitigated with options to opt in/out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant