On Wednesday, 7 November 2012 at 13:21:36 UTC, Peter Alexander wrote:
On Wednesday, 7 November 2012 at 13:07:13 UTC, Dejan Lekic wrote:
Therefore I would like to know what do you think about the idea of having additional operator exclusively made for ranges? This operator would make it obvious that data are "streamed" (lack of better term) among ranges.

The first name I could come up with was "opArrow" but "opData" could also be okay, and operator would be either "~>" or "->".

This would give us an obvious, unambiguous statement:

Console.in ~> filter1(param) ~> fooRange ~> Console.out;
// Console is an imaginary class/struct

Or:
arr ~> odd ~> random ~> randomOdd;

I'm confused. So does this new operator just do the same thing as dot, but only work with ranges? Or does it have additional useful semantics?

UFCS is what makes that code-mess I started with.
Imagine having ranges be part of some objects. I already gave an example of Console.in and Console.out. But say they are even deeper, so you have to refer to them using obj1.member.range notation, and now imagine using dot operator in some complex operation on ranges where you chain 5 or more ranges... All those dots and parenthesis can make head boil (at least it does make my head boil, not to mention that my colleague can's easily understand that statement at all written using UFCS).

Reply via email to