On Thu, Jan 28, 2010 at 1:26 PM, Andrei Alexandrescu <seewebsiteforem...@erdani.org> wrote: > Steven Schveighoffer wrote: >> >> On Thu, 28 Jan 2010 15:59:30 -0500, Andrei Alexandrescu >> <seewebsiteforem...@erdani.org> 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.
Maybe "property" is a misleading word. Clearly there are more things to which that applies than just what the traditional definition of the word would imply. I would not in English call my nose a "property" of me, but if I were a D object and had a .nose accessor, I would certainly think that accessor would qualify as a D property. How's this: anything that you can "get" without specifying additional information (and which doesn't change the outwardly visible state the object when you do so) is a property. The C# syntax with the special use of "get" and "set" perhaps does a better job of conveying this. --bb