|
|
|
|
|
by yeputons
1708 days ago
|
|
Yes: Ć has "dynamic references" (`shared_ptr`) denoted as `T#`, "read-only references" (`const T*`) denoted as `T`, "read-write references" (`T*`) denoted as `T!` and "storage" (`T`) denoted as `T()`. So you can (and probably should) do almost any memory management as you would in C++. Except I don't see any alternative for `weak_ptr` at the moment. |
|
Well that's already out the door because I almost never use shared_ptr in C++ code. The C++ core guidelines recommend using unique_ptr whenever possible. If you're going to use shared_ptr literally everywhere you do dynamic allocation, you'd be better off using a tracing GC to avoid the extra pointer indirection (and cache miss) with every dereference.
It seems to me that Cito should have manual memory management because a manual memory language can be trivially mapped onto a GC language (just turn every free or delete to an nop), while the inverse problem is intractable in the general case.