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

subscribe should be synchronous #64

Closed
benlesh opened this issue Jul 10, 2015 · 4 comments
Closed

subscribe should be synchronous #64

benlesh opened this issue Jul 10, 2015 · 4 comments
Assignees

Comments

@benlesh
Copy link
Member

benlesh commented Jul 10, 2015

Based on discussions on the es-observable spec repo, it's been collectively determined that subscription and observation must be synchronous by default for performance reasons.

One of the lead examples was groupBy, as pointed out by @trxcllnt... if subscription is always async, you'll potentially have to buffer an unbounded number of values that could be synchronously pushed at newly created "Grouped" Observables.

There's also a smaller matter of incurring extra turns for no real gain if this functional programming type is being used purely functionally.

The danger here is to those that are using mutable state and imperative programming. In those situations, there might be some strange behaviors. It is my view that this should simply be taught to people via warnings and best practices.

@benlesh
Copy link
Member Author

benlesh commented Jul 10, 2015

cc/ @vsavkin @jeffbcross @IgorMinar

FWIW: For concerns about Zalgo when creating a library such as Angular's data access, the library implementor could use subscribeOn on any observable it returns from itself in order to force an async subscription behavior without effecting the ergonomics for the end user developer.

@headinthebox
Copy link

That is why subscribeOn and observeOn exist!

@BerkeleyTrue
Copy link

Yay! That makes my life easier.

@benlesh benlesh self-assigned this Jul 12, 2015
@benlesh benlesh mentioned this issue Jul 12, 2015
1 task
@benlesh
Copy link
Member Author

benlesh commented Jul 17, 2015

Done in master.

@benlesh benlesh closed this as completed Jul 17, 2015
@lock lock bot locked as resolved and limited conversation to collaborators Jun 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants