Comments (4)
I'm going to close this issue. Even if you default to an async scheduler, we'll still need the immediate scheduler for some functional tests.
from rxphp.
This occasionally blows out the stack
With XDebug or just infinite stack => segfault?
some operators won't work at all.
Is there an example, or a reference of this?
The ImmediateScheduler mostly seems to exist because it was easy to run small demos with it when the project was still young. It's unusable for anything serious. Should we:
Those small demos are still kinda required. What is the alternative approach?
from rxphp.
Here's an example that will give the wrong output and then segfault:
$o1 = Rx\Observable::just(42)->repeat();
$o2 = Rx\Observable::just(21)->repeat();
$mergedObservable = $o1
->merge($o2)
->take(10);
output:
Next value: 42
Next value: 42
Next value: 42
Next value: 42
Next value: 42
Next value: 42
Next value: 42
Next value: 42
Next value: 42
Next value: 42
Complete!
[1] 59785 segmentation fault ...
expected output:
Next value: 42
Next value: 21
Next value: 42
Next value: 21
Next value: 42
Next value: 21
Next value: 42
Next value: 21
Next value: 42
Next value: 21
Complete!
from rxphp.
As I see it - the pros and cons of the ImmediateScheduler are:
Pros:
- Can write simple demos for some of the operators.
- Requires no boilerplate code for the things that work with it.
- You don't need an event loop.
Cons:
- Most test cases use a scheduler that actually schedules items, so almost all test cases are not valid for the ImmediateScheduler.
- Execution ordering can be different with the ImmediateScheduler than with others.
- ImmediateScheduler has a tendency to blow the stack.
- Cannot do anything that requires timing (interval, timeout, delay, etc.).
I would prefer that we move away from the ImmediateScheduler. This would mean that the barrier to entry would be a tiny bit higher in that people will at the very minimum need to start a loop or scheduler (unless we make a scheduler that autostarts either on subscribe or at the end of execution).
It is possible to make a really simple scheduler that just uses sleep if we wanted the bare minimum scheduler - but that would still require a start.
from rxphp.
Related Issues (20)
- Promise::fromObservable should be cancelable
- Update PHPUnit to 5.7
- Disposed of scheduled item does not cancel timer in some instances
- EventLoopScheduler does not cancel timer in certain circumstances
- Not getting any output in the console HOT 6
- Weird result for Iterators and Generators and multiple listeners/subscribers HOT 2
- Change behavior when exception occurs in `onNext` HOT 1
- multi-threads support HOT 5
- Observable from function HOT 3
- How to resume on next after catch? HOT 3
- Unexpected Script Execution within PHP 7.3 HOT 8
- Test not working HOT 2
- Is this still maintained? HOT 1
- When trying to write a test I get 'Error: Call to undefined function Tests\onNext()' HOT 1
- Implement mergeDelayError HOT 2
- PHP 8 Compatibility HOT 4
- Handling streams HOT 1
- Pluck will error on null value
- [ General question ] functional API, RxJS-like HOT 2
- changing behavior of interval function
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rxphp.