New Issue: How should we control parallel-safety for 'list'?

18097, "e-kayrakli", "How should we control parallel-safety for 'list'?", "2021-07-22T23:24:45Z"

list is not parallel-safe by default. However, you can opt-in for parallel-safety by new list(int, parSafe=true). Currently, enabling parallel safety makes some of the list methods give compiler errors, if they are used. These methods are; this, first and last. Where the rationale is that the reference they return could be invalidated by a parallel task if it happens to remove something from the list.

There are some questions about how parallel-safety should be handled by list. Some options are:

  1. Make list a non-parallel safe structure, add a new data structure that's parallel-safe
  2. Make this, first and last compile, but add warnings in the documentation that they should be used with care in parallel contexts.
  3. Make parallel-safety less prominent:
    a. Control parallel-safety in method granularity instead of type granularity
    b. Instead of parSafe, call it locking or something less assuring
  4. ...

Personally, I find creating a separate data structure only for parallel-safety a bit of an overkill. And I am not quite happy with the current state of methods giving compiler errors with parallel-safety on. I would like to consider 2 and maybe some of 3.