Struggling to implement parallel foreach...

Manu turkeyman at gmail.com
Sat Jun 15 02:40:56 UTC 2019


On Fri, Jun 14, 2019 at 3:35 PM Timon Gehr via Digitalmars-d
<digitalmars-d at puremagic.com> wrote:
>
> On 14.06.19 20:51, Manu wrote:
> > On Fri, Jun 14, 2019 at 8:05 AM Kagamin via Digitalmars-d
> > <digitalmars-d at puremagic.com> wrote:
> >>
> >> On Friday, 14 June 2019 at 09:04:42 UTC, Manu wrote:
> >>> Right, exactly... the compile error should be at the assignment
> >>> of the
> >>> not-shared closure to the shared delegate. The error would be
> >>> something like "can't assign `Context*` to `shared(Context)*`".
> >>> So, the function can certainly exist, but for shared, you
> >>> should get
> >>> an error when you attempt to call it passing the closure to the
> >>> function.
> >>
> >> The shared function attribute means that its context is shared
> >> similar to object methods, the error is an attempt to implicitly
> >> leak unshared data into that shared context, that's why indeed
> >> function itself is incorrect. Declare the variable as shared and
> >> it will work.
> >
> > No, you've misunderstood. The qualifier does NOT apply to the context
> > as it should, that's the issue I'm reporting.
>
> There is a bug, but It appears you don't understand what it is. Why do
> you insist on reporting the bug in a particular wrong way instead of
> trying to understand what is actually going on?

So, what is actually going on? (I believe I'm aware what is going on,
because behaviour is self-evident).
And more importantly, how is it useful? Why is it so useful that it
should it violate default behaviour, and expectation?
I know how it's not useful.


More information about the Digitalmars-d mailing list