On Thu, Jan 28, 2010 at 1:55 PM, Michiel Helvensteijn <m.helvensteijn.rem...@gmail.com> wrote: > Andrei Alexandrescu wrote: > >>>> foreach (line; stdin.byLine()) { ... } >>>> >>>> vs. >>>> >>>> foreach (line; stdin.byLine) { ... } >>>> >>>> How do I choose? >>> >>> byLine is a property. It is fetching a range on stdin. >>> >>> -Steve >> >> Damn. I was sure the answer will be different. > > byLine() is a function. It changes the state of stdin. Calling it > consecutively will in general result in different return values. If there > were two guys: stdin.currentLine (property) and stdin.nextLine(), it would > be a different story.
That's not how it works, I think. Just calling byLine() by itself only returns a range struct. Consuming things from that range is what changes the state of stdin. --bb