A Python replacement, this ain't. More like C++ on quaaludes.
A Python replacement, this ain't. More like C++ on quaaludes.
(Edit, re below reply: It depends how you define "allocation"; it's either two or three. I wasn't considering the stack as allocation, but you're right that Rust takes the traditional stack/heap distinction and expands it to stack/exchange heap/task heap. We should update the tutorial to make it clear that borrowed pointers work for the stack as well as both heaps.)
I agree that the language is not designed to be a Python replacement, however. No language is suitable for every task.
"7.3 What to be aware of
Rust has three "realms" in which objects can be allocated: the stack, the local heap, and the exchange heap. These realms have corresponding pointer types: the borrowed pointer (&T), the shared box (@T), and the unique box (~T). These three sigils will appear repeatedly as we explore the language. Learning the appropriate role of each is key to using Rust effectively."
It's 3 different types, not 2.