www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Duals or ranges and reactive D

reply "Szymon Gatner" <noemail gmail.com> writes:

[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
Feb 27 2014
next sibling parent "Szymon Gatner" <noemail gmail.com> writes:
On Thursday, 27 February 2014 at 12:41:14 UTC, Szymon Gatner 
wrote:

Topic should of course be: "Duals OF ranges and reactive D"
Feb 27 2014
prev sibling next sibling parent reply Timon Gehr <timon.gehr gmx.ch> writes:
On 02/27/2014 01:41 PM, Szymon Gatner wrote:

 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
Mar 08 2014
parent reply "Szymon Gatner" <noemail gmail.com> writes:
On Saturday, 8 March 2014 at 12:01:10 UTC, Timon Gehr wrote:
 On 02/27/2014 01:41 PM, Szymon Gatner wrote:

 [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?
Mar 10 2014
parent Timon Gehr <timon.gehr gmx.ch> writes:
On 03/10/2014 08:26 PM, Szymon Gatner wrote:
 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?
I've written it in response to you post. (Note that it works with DMD 2.064.)
 How do you feel about the concept?
It does not make a lot of sense with value semantics, so efficiency might be a concern. I don't know how useful this specific implementation (that deviates from std.range only slightly) would be in practice (e.g. probably one wants to be able to reserve space even if writing is not random access.)
Mar 11 2014
prev sibling next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 2/27/14, 4:41 AM, Szymon Gatner wrote:

 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
Continuing an old thread. Seems like the Observable interface pioneered by RX would be of interest and good use to D, since observables are the dual of ranges and ranges are so useful to us. Erik Meijer sent me a bunch of informative links about Rx, pasted below. I've perused a few and gained an understanding of Rx, and will grab him for some more chat later. I think this is a great project to look into, but currently can't dedicate much time to it. I encourage anyone who feels passionate about this to grab the torch. Thanks! * Netflix use case server: http://techblog.netflix.com/2013/01/optimizing-netflix-api.html, client: http://channel9.msdn.com/posts/YOW-2012-Jafar-Husain-Rx-and-Netflix-A-Match-Made-in-Composable-Asynchrony. * RxJava: https://github.com/Netflix/RxJava/wiki, have a look at the docs https://github.com/Netflix/RxJava/wiki/Transforming-Observables#groupby-and-groupbyuntil. * Increasingly people are providing RX bindings such as http://slid.es/petermd/eclipsecon2014, http://camel.apache.org/rx.html. * The Soundcloud folks started using RxJava on Android, http://mttkay.github.io/blog/2013/08/25/functional-reactive-programming-on-a droid-with-rxjava/, and now that is catching like wildfire. http://markhudnall.com/2013/10/15/rxjava-and-android/. * GitHub is also all in on Rx, they wrote an ObjectiveC port https://github.com/ReactiveCocoa/ReactiveCocoa. * Early implementation for PHP https://github.com/asm89/Rx.PHP * RxJs: https://github.com/Reactive-Extensions/RxJS. There are bindings for several frameworks https://github.com/Reactive-Extensions/RxJS#what-about-my-libraries. * Internal course for Netflix front-end engineers https://github.com/jhusain/learnrx. * www.introtorx.com a free book written by a guy who has been using Rx to make real $$$$ writing high frequency trading algos in London. * The new lift-based implementation makes it relatively straightforward to port an Rx implementation to another language; the main engineering effort wrt to pert is how to best handle thread safety. In RxJava we tried to do as much lock-free styles as possible, but the downside is crazy complex CAS state machines, and in many cases you cannot beat the JVM JIT when it comes to using regular locks & synchronized methods. Andrei
May 08 2014
prev sibling parent reply "Ola Fosheim =?UTF-8?B?R3LDuHN0YWQi?= <ola.fosheim.grostad gmail.com> writes:
Reactive programming is related to dataflow, so you will run into 
problems when you get beyond toy-size programs. Though, with 
compiler support…

http://cs.brown.edu/~sk/Publications/Papers/Published/bck-lowering-opt-trans-frp/paper.pdf
May 08 2014
parent jadbox <jadit2 gmail.com> writes:
On Thursday, 8 May 2014 at 19:52:01 UTC, Ola Fosheim Grøstad 
wrote:
 Reactive programming is related to dataflow, so you will run 
 into problems when you get beyond toy-size programs. Though, 
 with compiler support…

 http://cs.brown.edu/~sk/Publications/Papers/Published/bck-lowering-opt-trans-frp/paper.pdf
Any update on introducing Observable push concepts into D?
Oct 23 2015