byKey and byValue: properties or methods?
Steven Schveighoffer
schveiguy at yahoo.com
Thu Jan 19 14:43:26 PST 2012
On Thu, 19 Jan 2012 14:06:00 -0500, torhu <no at spam.invalid> wrote:
> On 19.01.2012 19:17, Steven Schveighoffer wrote:
>>
>> That's like saying this:
>>
>> int[] arr;
>>
>> int l = arr.length;
>> l++;
>>
>> should be the same as this:
>>
>> arr.length++;
>>
>> because it's a property.
>>
>> This is an orthogonal problem. byKey doesn't try to affect the original
>> AA, so the semantics should be the same whether you save a copy or
>> access
>> it in one line.
>>
>> There are no hard-fast rules on what should be properties and what
>> shouldn't. But the rvalue vs lvalue is an orthogonal problem.
>
> If the type of byKeys is Range, I would expect to be able to treat it
> like one. Not like one, then another, then another, then another... ad
> infinitum.
I don't know what you mean. You can treat it like one.
-Steve
More information about the Digitalmars-d
mailing list