Very limited shared promotion

Timon Gehr timon.gehr at gmx.ch
Tue Jun 18 14:18:10 UTC 2019


On 18.06.19 16:14, Timon Gehr wrote:
> On 18.06.19 16:13, Timon Gehr wrote:
>>
>> int sum(){ // note: just to illustrate the concept
>>      int result=0;
>>      foreach(i;iota(1000).parallel){
>>          static assert(is(typeof(result)==shared(int)));
>>          result.atomic!"+="(i);
>>      }
>>      static assert(is(typeof(result)==int));
>>      return result;
>> }
> 
> Return type should have been int, of course...

And there should have been is expressions. Getting tired from pushing 
back against all the nonsense. Just note that if you can make the above 
work with useless qualified capturing, you can do so with useful 
qualified capturing and this is so blatantly obvious that it causes me 
physical pain that Manu honestly does not see it.


More information about the Digitalmars-d mailing list