This project is read-only.

Strange rxcpp::Never behavior



The line presented below causes abort signal to be risen:
from( rxcpp::Never<int>( ) ).subscribe( []( int ) {} );
I was wondering if this is a correct behavior, a similar expression in Rx for C# doesn't cause any errors.


kirkshoop wrote Feb 21, 2014 at 11:07 PM

Well I intentionally made it call abort when destructing a subscription that has not been stopped (Disposed, Errored or Completed)

To make it not abort() uncomment the Dispose() call
        auto d = from(rx::Never<int>()).subscribe([](int){});
This is certainly up for discussion. If a subscription should just silently die when it exits scope this check can be removed from the AutoDetachObserver to achieve that.

Andy_Bogard wrote Feb 23, 2014 at 1:15 AM

Thank you for your explanation. I think that the behavior described by you is correct. At the beginning I thought that raising an abort signal is a bug, because an expression similar to the one presented above works just fine:
rxcpp::from( rxcpp::Never<int>( ) )
         .concat( rxcpp::Never<int>( ) )
         .subscribe( []( int ) {} );
Although the subscription hasn't been stopped, the abort signal wasn't risen.
So it seems that the problem lies in merge and concat operators.