20334, "benharsh", "Memory.Initialization: moveSwap function signature", "2022-07-29T20:16:10Z"
The current signature of
proc moveSwap(ref lhs: ?t, ref rhs: t)
There are some minor issues regarding the function signature:
We should explicitly state the return type is
rhs Don't really make sense in this context, as they somewhat imply a direction. Rust uses
y for its swap functions formal names, and C++ uses
std::swap. I propose using
We could use a similar tactic as proposed in (#20328) where we have a second generic
moveSwap function that accepts fully-generic arguments and issues a
compilerError. At this point though, I wonder if we could do something a bit nicer within the compiler itself for trivial cases like
X : ?T, Y : T.