More pure optimizations
Brad Roberts
braddr at puremagic.com
Wed Jun 3 21:27:50 PDT 2009
Ary Borenszweig wrote:
> bearophile escribió:
>> Ary Borenszweig:
>>> What if a different thread modifies h in between the loop?
>>
>> "h" associative array as a thread-local?
>
> but from the method's signature:
>
> int foo(int[string] h)
>
> you can't tell that h is thread-local or not. Is that what you mean?
In D2, with shared vs non-shared memory becoming explicit, non-shared const
parameters can become legal pure parameters. Since non-const can implicitly
convert to const, as long as the assoc array is non-shared and the key is
non-shared, then ... all the pieces fall into place to allow assoc array's
opIndex to have a pure version.
Whee,
Brad
More information about the Digitalmars-d
mailing list