Copy vs Move Semantics
How values are duplicated or relocated.
Two Ways to Pass Along
When a value moves around your program, Mojo can either copy it or move it. Knowing which happens helps you reason about cost. 🔁
What a Copy Is
A copy makes a brand-new, independent value. Both the original and the copy live on, each owning its own data.
var a = MyType(1)
var b = a # copy: a still validAll lessons in this course
- Copy vs Move Semantics
- The __copyinit__ Method
- The __moveinit__ Method
- Destruction and __del__