Very limited shared promotion

rikki cattermole rikki at cattermole.co.nz
Wed Jun 19 10:36:49 UTC 2019


On 19/06/2019 3:20 PM, Manu wrote:
> I'll just tweak your example one more little bit to make sure
> absolutely everything I care about is captured correctly:
> 
> struct S {
>      int result;
>      void inc(int i) shared { result.atomic!"+="(i); }
> }
> int sum(){
>      S s;
>      foreach(i; iota(1000).parallel){
>          static assert(is(typeof(s) == shared(S)));
>          s.inc(i);
>      }
>      static assert(is(typeof(s) == S));
>      return s.result;
> }
> 
> The combinations of primitives at work here will solve every challenge
> I'm aware of in our engine.

Okay is everyone in agreement that this is a use case for D?
If so, lets get this into bugzilla!


More information about the Digitalmars-d mailing list