| Rust - Native Code |
| Source code |
Compiles to native code executed by its process |
| Objects |
stored in function's stack frame unless explicity placed in heap with Box |
| Object management |
provided by program code and library, e.g., creation, deallocation, error handling |
| Types |
Rust has two categories of types: Copy types and Move types. Copy types have value behavior.
Move types transfer ownership when assigned or passed by value.
|
| Moves |
Rust treats all types that are not copy (satisfy the Copy trait) as moves. It enforces single ownership
so source becomes invalid after move.
|
| Pros and Cons |
excellent performance and safety. Initially hard to build due to safety
constraints, but once built is very likely to have correct implementation.
|
| C++ - Native Code |
| Source code |
Compiles to native code executed by its process |
|
Objects
|
stored in function's stack frame unless explicity placed in heap or static memory
|
| Object management |
provided by program code, e.g., creation, deallocation, exception handling |
| Types |
Language enables user-defined objects to behave like primitive types, e.g., value behavior,
through use of constructors and assignment operators.
|
| Moves |
C++ provides move constructors but does not enforce single ownership, allowing use of source
after move, possibly resulting in undefined behavior.
|
| Pros and Cons |
excellent performance, requires care to avoid paths to undefined behavior
|
| C# - Managed Code |
| Source code |
Compiles to byte-code, jitted and executed by its process's virtual machine |
| Object storage |
object handles stored in function's stack, pointing to instances stored in heap |
| Object management |
provided by virtual machine using garbage collector and VM events |
| Types |
Types are either value or reference types, with quite different behavior |
| Moves |
C# does not provide move operations.
|
| Pros and Cons |
promotes safety at the expense of performance and initial latency
|
| Python - Interpreted Code |
| Source code |
Compiled to bytecode (.pyc), interpreted by the CPython VM; PyPy JIT-compiles hot paths to native code |
| Object storage |
all objects reside on the heap; variables hold references (pointers) to heap objects, never the objects themselves |
| Object management |
reference counting is the primary mechanism; a supplemental cyclic garbage collector handles reference cycles |
| Types |
everything is an object, including integers and functions; duck typing — type is checked at runtime,
not compile time; type hints (PEP 484) are optional annotations, not enforced by the interpreter
|
| Moves |
Python has no move semantics; assignment binds a new name to the same object and increments its reference count.
Mutability governs whether the object's state can be changed through any binding.
|
| Pros and Cons |
highly productive and readable; vast ecosystem; slow for CPU-bound work; the CPython GIL
prevents true multi-core parallelism within one interpreter process
|