[RFC] Add an operator for ranges to D. Pros and cons?

Tavi Cacina octavian.cacina at outlook.com
Wed Nov 7 05:56:53 PST 2012


On Wednesday, 7 November 2012 at 13:07:13 UTC, Dejan Lekic wrote:
> I humbly believe that ranges are one of the most important 
> concepts in D

yeah, the range chaining is quite cool. I am just starting with 
D, and I find this formatting most appealing (took from a comment 
of an article about components).

   Console.in         // get some input
   .filter1(param)    // filter it based on X
   .fooRange          // tweak it some more
   .Console.out;      // beam it up, scotty

It allows to describe the chaining inplace. You have though a 
point, if you are combining the ranges in a long 'sausage', a 
dedicated operator may increase the readability.



More information about the Digitalmars-d mailing list