[Issue 15129] std.parallelism.parallel doesn't enforce shared-correctness

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jan 16 12:15:15 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=15129

Nick Treleaven <nick at geany.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |safe
                 CC|                            |nick at geany.org

--- Comment #1 from Nick Treleaven <nick at geany.org> ---
> it is sufficient for the context to be const, otherwise it probably needs to be immutable.

`i` should be declared `shared` for safe mutation. To support that, the
ParallelForeach.opApply delegate context parameter should require `shared`
(which would allow `immutable` too). Unfortunately the opApply delegate doesn't
support `shared` (or `immutable`) context inference AFAICT.

--


More information about the Digitalmars-d-bugs mailing list