Struggling to implement parallel foreach...

Manu turkeyman at gmail.com
Mon Jun 17 01:26:53 UTC 2019


On Sun, Jun 16, 2019 at 6:00 PM Kagamin via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On Saturday, 15 June 2019 at 06:13:09 UTC, Manu wrote:
> > struct S
> > {
> >   void method() shared;
> > }
> >
> > void test()
> > {
> >   S s;
> >   void localFun() shared
> >   {
> >     s.method(); // <- s must transitively receive const from the
> > context pointer, otherwise this doesn't work
> >   }
> > }
> >
> > Current semantics would reject this, because s is not shared,
> > and
> > therefore not accessible by localFun.
> > The unnecessary complexity inhibits the only useful thing that a
> > shared function can do.
>
> Declare `s` as shared and it will work.

`s` is not declared as shared... nothing is ever declared as shared,
that's why the current design is completely useless.


More information about the Digitalmars-d mailing list