core
core copied to clipboard
[BUG] queue transfer to self should be no-op
Describe the bug queue transfer to self should be no-op
To Reproduce
fn main {
let q = @queue.of([1, 2, 3])
q.transfer(q)
println(q)
}
ouputs @queue.of([])
Expected behavior @queue.of([1, 2, 3])
/// Transfers all elements from one queue to another.
///
/// Adds all of the elements of source to the end of destination, then clears source.
This is not intuitive. The implementation detail should not lead API design
It is what it is. Transferring to self doesn't make sense either. With that said, with the append implemented, I would rather deprecate this API.
However, append will not imply the empty operation on source.
Yes, and it is exactly this empty operation is bizarre when the source and dst refers to the same one