|
He's saying people are turning it into a buzz word that is losing it's true meaning, so instead of the buzz word, think of what it's really all about: composing and managing side-effects. Take a look at Google Trends for "Reactive Programming", it spiked over the last year or so,: http://www.google.com/trends/explore#q=reactive%20programmin... Take a look on GitHub at all the projects with reactive in the name or descriptions; it's become a buzzword that people use to describe various things that don't have any relationship to the original. Iterable is broken, as Erik said, because it has a hasNext() method, and a next() method, which is a problem because hasNext() causes side-effects to be evaluated. Imagine if the implementation of the iterator has to execute a long running function, or wait for the next value in an observable to be pushed, like an event. So, if call hasNext() twice, then it may cause a side effect so that next() actually has a different result than it would without the side effect. Thus, it is not mathematically, a function, and can't really be used to build monads. So, unfortunately, due to backwards compatibility, Java classes that implement Iterable/Iterator can't automatically get the benefits of list monads etc..., by simply defining a library of operators that take Iterable/Iterators, like C# could with IEnumerable/IEnumerator. In C#, IE only has side effects in the MoveNext() method, which returns true or false if there's another element, and the effect is explicit in the name, which helps. However, more importantly, if you get the value from Current, there is no side effect, and you can do that as many times as you like. With Iterable, if you call next() it moves to the next element. So, it is impossible to get the same value twice with a guarantee of no side effects, and impossible to guarantee mathematically sound composition of Iterables. The interface is broken, and changing it would break nearly every Java program. |