1
Vote

Strange rxcpp::Never behavior

description

Hi,

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.

comments

kirkshoop wrote Feb 21, 2014 at 10: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){});
        //d.Dispose();
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 12: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.