Revised RFC on range design for D2

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Fri Oct 3 07:02:07 PDT 2008


Sergey Gromov wrote:
> Thu, 02 Oct 2008 15:03:42 -0500,
> Andrei Alexandrescu wrote:
>> Yah, overloaded ops are due for an overhaul. I'm almost afraid to ask... 
>> any ideas? :o)
>>
>> One goal is to fix opIndexAssign and make it work similar to the way it 
>> works in arrays, e.g. a[b] += c. Indexing into hash tables is a good 
>> test bed.
> 
> What's wrong with a.opIndexAssign(b, a.opIndex(b) + c)?

One problem is that for a hashtable that does not have b yet, opIndex 
will throw an exception.

Another problem (assuming the above is fixed) is that b will be looked 
up twice in the hash.


Andrei


More information about the Digitalmars-d-announce mailing list