byKey and byValue: properties or methods?

torhu no at spam.invalid
Sat Jan 21 08:48:27 PST 2012


On 21.01.2012 02:43, Andrei Alexandrescu wrote:
>
> A good outcome of this vote might have been the distillation of some
> simple guidelines, as opposed to enforcing some arbitrary consistency.
> Apparently the participants in this thread are divided regarding general
> rules as well as their applicability to this particular case.

I think that the people here have two different views of what a property is:

1) Just way to hook up some code to what looks and (mostly) behaves like 
field access.
2) A property of some object, in a wider sense.

Examples of 1) are:  Creating a read-only field, or delaying calculating 
a value until first use and then caching it for future use.  An example 
of 2) would be saying that the set of keys of an AA is a property of 
that AA.

As I see it, the main difference between 1) and 2) is that with the 
latter you are giving field access (dot) syntax a new logical meaning 
that it didn't use to have.  Which why I'm weary of things like 
aa.byKey.  What is the gain, not having to type parentheses?  That's not 
a lot.


More information about the Digitalmars-d mailing list