New Issue: Should/could 'List.append()' return the index of the element that was inserted?

17466, "bradcray", "Should/could 'List.append()' return the index of the element that was inserted?", "2021-03-25T23:09:40Z"

Summary of Problem

As a Chapel programmer, it seems that it would be convenient for List.append() to return the list index where the element was inserted, particularly in the case of multiple tasks inserting items into the list simultaneously (such that querying the list's size before or after insertion wouldn't be guaranteed to be atomic w.r.t. the appended element).

Steps to Reproduce

Source Code:

use List;
var l: list(int);
var i = l.append(42);
writeln(l[i]);

Compile command:
chpl testit.chpl

Configuration Information

  • Output of chpl --version: 1.24.0