I did not read everything here, but my knowledge so far is, that seq and string is in fact a garbage collected heap object, despite the fact that semantically it is almost identical to the c++ std::string and the c++ std::vector. So copy on assignment etc. This is according to my information done, because it was the easiest way to implement it. But Araq is working at the moment to optimize the seq and string type to me non-nil able. That could also mean that they won't require garbage collection anymore, but that is just an assumption.
And for returning values. Nim could theoretically behave exactly like c++, meaning that a return would be implemented as a move operation. A move is much more like a shallow copy, but it invalidates the source it gets moved from. so sot the entire vector is copied, just the header that is pointing to the data. This is possible, because it is known that the result from the function scope is destroyed after return. that means the outer object can take over the ownership of the data from the result value. Then there is another possible optimization. When the function gets inlined, the the local object is initialized directly at its final destination. So not even a move needs to be performed anymore. There is no need to explicity use the result value, because everything can be converted to use the result value, the result value just makes it a bit easier to understand how a function would behave when it is inlined.
