On Friday, 13 September 2013 at 17:35:21 UTC, Brad Anderson wrote:
On Friday, 13 September 2013 at 14:39:29 UTC, Chris wrote:
On Friday, 13 September 2013 at 13:42:07 UTC, Dicebot wrote:
On Friday, 13 September 2013 at 13:31:18 UTC, bearophile wrote:
In most cases today you are free to omit those ():

foreach (bySentence.byWord.byWhateverFormat.byReformatAgain) {

Bye,
bearophile

...but you shouldn't if you care about readability (leave at least the last pair in the line) :P

It also helps other people (and me) to realize that it actually _does_ something and doesn't just return a value. Often (not always of course), if you omit the brackets it returns a value without doing anything. But that's just a personal convention I might abandon further down the road.

Since most ranges in std.algorithm are lazy they are usually not doing anything but setting a few members and returning a new range, often without having even touched the input range. Thinking about it I think I may start using () to denote eager versus lazy ranges in my UFCS chains.

This reminds me, I have to check whether my ranges are lazy enough (like myself).

Reply via email to