Duals or ranges and reactive D

Szymon Gatner noemail at gmail.com
Mon Mar 10 12:26:34 PDT 2014


On Saturday, 8 March 2014 at 12:01:10 UTC, Timon Gehr wrote:
> On 02/27/2014 01:41 PM, Szymon Gatner wrote:
>> C#'s IObservable<>/IObserver<> made me think how would a dual 
>> [1][2] of
>> a range concept look in D. Since D has no equivalent 
>> IEnumerable<> (as
>> it is no needed thanks to templates) it is only about 
>> IEnumerator<> /
>> IObserver<> part which relates to a D range.
>>
>> Ranges/enumerators are models of 'pull' style interface 
>> whereas their
>> duals represent models of 'push' style enabling reactive 
>> programming [3]
>> techniques which are really nicely solving issues of 
>> asynchronous /
>> event - based programming.
>>
>> I suppose OutptRange is similar in concept, although it has
>> 'OnCompleted' / 'OnError' missing.
>>
>> What do you think? Rx along with LINQ is a really clean 
>> solution to the
>> problem of asynchronous ranges of values. I think it would be 
>> very nice
>> to have in D too.
>>
>> [1] 
>> http://csl.stanford.edu/~christos/pldi2010.fit/meijer.duality.pdf
>> [2] 
>> http://josemigueltorres.net/index.php/ienumerableiobservable-duality/
>> [3]
>> https://channel9.msdn.com/Shows/Going+Deep/Expert-to-Expert-Brian-Beckman-and-Erik-Meijer-Inside-the-NET-Reactive-Framework-Rx
>>
>
> In case you are interested, I have thrown together a small 
> proof of concept implementation: 
> http://dpaste.dzfl.pl/9d8386768da0

Wow, that is now what I'd small ;) I will definitely take a look.

Is it something you already had written or something new? How do 
you feel about the concept?


More information about the Digitalmars-d mailing list