Fun project - faster associative array algorithm
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Tue Apr 7 15:33:52 PDT 2015
On 4/7/15 6:27 PM, Andrei Alexandrescu wrote:
> On 4/7/15 3:22 PM, deadalnix wrote:
>> On Tuesday, 7 April 2015 at 22:14:46 UTC, Andrei Alexandrescu wrote:
>>> Arrays would need to move data. Current hashtables rely on values
>>> staying put. -- Andrei
>>
>> I think it is fair to say current AA are bankrupt and need a revamping
>> anyway.
>
> Doesn't strike me as a fair statement.
>
>> We can make the in operator return a wrapper that cast to bool (safely)
>> and get/update the data (systemely).
>
> That's not enough. People may take the address of elements in the
> hashtable and assume the data stays put. This is currently safe and
> legal in D.
The correct way forward is to implement the AA in the library in the
safest way possible. Then, make the library implementation customizable
for specialized situations. But it needs to be fully in the library, not
partly in the compiler as it is now. Until that point, all these
discussions on AA updates are useless.
-Steve
More information about the Digitalmars-d
mailing list