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

(fp/no-nil) rule for callbacks? #43

Closed
Dylanb-dev opened this issue Mar 21, 2018 · 5 comments
Closed

(fp/no-nil) rule for callbacks? #43

Dylanb-dev opened this issue Mar 21, 2018 · 5 comments

Comments

@Dylanb-dev
Copy link

It is standard to write callbacks with error first so you end up with callback(null, "success message") or callback(err).

Is the solution to get around this to not use callbacks?

@graingert
Copy link
Collaborator

oh yes, you can't use callbacks because by their nature they're not pure

@Dylanb-dev
Copy link
Author

Yeah just a lot of code has this convention and wanted the ruling on it.

I will try to use promises instead of callbacks.

@graingert
Copy link
Collaborator

I'd recommend using some effects library like Monet or IxJS then converting to a promise or continuation passing API at the last possible moment.

@graingert
Copy link
Collaborator

promises are also impure!

@Dylanb-dev
Copy link
Author

Yeah I have separated side effects from my functions in my codebase but at the end it has a callback.

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

2 participants