Conversation
wip Update nnnn-rigidarray-uniquearray.md Update nnnn-rigidarray-uniquearray.md Update nnnn-rigidarray-uniquearray.md Update nnnn-rigidarray-uniquearray.md Update nnnn-rigidarray-uniquearray.md Update nnnn-rigidarray-uniquearray.md
Co-authored-by: Ben Rimmington <me@benrimmington.com>
Co-authored-by: Ben Rimmington <me@benrimmington.com>
Co-authored-by: Ben Rimmington <me@benrimmington.com>
Co-authored-by: Ben Rimmington <me@benrimmington.com>
Review and amend RigidArray/UniqueArray proposal text
| For example, we could have mutations trigger a runtime error, or we could add | ||
| new arguments to mutations that describe specifically how to clone elements. | ||
| In practice, neither of these options lead to an acceptable programming | ||
| experience. |
There was a problem hiding this comment.
Why not? We don't need a big explanation here, but a sentence of explanation would be much stronger than just handwaving it away.
| /// Copy the contents of this array into a newly allocated {rigid|unique} array | ||
| /// instance with just enough capacity to hold all its elements. | ||
| /// | ||
| /// - Complexity: O(`count`) |
There was a problem hiding this comment.
Am I inferring correctly that the clone has capacity == count (i.e. any tail capacity is not cloned)? This is what the docs appear to promise, but it is slightly weird that two "clones" do not behave the same.
Either way, the doc comment should be a little more explicit.
There was a problem hiding this comment.
Am I inferring correctly that the clone has capacity == count (i.e. any tail capacity is not cloned)?
That is currently what the implementation does yes.
| /// - Parameter capacity: The desired capacity of the resulting {rigid|unique} array. | ||
| /// `capacity` must be greater than or equal to `count`. | ||
| /// | ||
| /// - Complexity: O(`count`) |
There was a problem hiding this comment.
Complexity is potentially O(capacity) on a platform where the underlying allocator eagerly initializes. This may not matter for the purposes of this comment.
No description provided.