Open oshyshko opened 2 years ago
I agree that documentation is rather confusing and assumes that reader is familiar with memcpy
/memmove
and their corresponding gotchas
copy Copy a vector from source to destination. Both vectors must have same length and may not overlap. If any condition is violated exception is thrown.
move Copy vector from source to destination. Both vectors must have same length. Unlike copy it allows source and destination to overlap.
Dropping distinction between copy and move would be nice of course. But then there's question: how much performance do we get by maintaining that distinction?
There's also problem of overlap not being powerful enough: https://github.com/haskell/vector/issues/88
It's not clear what is the difference between "copy" and "move".
Consider changing "may" to a strong "must" and adding a line on what happens otherwise:
To:
It was unclear what is the meaning of "moving a vector" and what is the difference VS "copying data".
Consider explaining "move" in terms of "copy" and changing:
To:
In short: different copying order. If two vectors overlap, the order of copying
offset + (zero..length)
VSoffset + (length..zero)
can be chosen, depending on which of the two vectors (source and target) goes first in address (index) space. No need to allocate temporary memory.