Rant time? Rant time.
nise at nise.com
Tue Sep 22 10:30:38 UTC 2020
On Tuesday, 22 September 2020 at 10:00:46 UTC, Ola Fosheim
> I believe Microsoft has a research language where ownership is
> tied to a group of objects.
> I actually think C++'s model works out ok, when you add custom
> allocators to the mix. But it would be better if the compiler
> could ellide allocations or simply avoid calling
> side-effect-free destructors if the entire (local) allocator
> pool was released. I also want compiler support for embedded
> refcounts (shared_ptr is costly).
> There is no certain way to establish how memory is allocated
> and released in C++, so that does prevent (analytical)
> optimization opportunities.
> The key challenge is really providing some mechanisms that
> makes memory management, initialization and finalization
> analytically tractable and providing more optimization
> (I think "provably memory safe" is too expensive in terms of
> development freedom and time, so ignore that aspect. "Safer" is
> good enough. "Safe" isn't really needed or realistic.)
Pony is another language that allows objects cross referencing
but just like the Microsoft research language they have something
called "regions" in which the objects are allowed to cross
In Rust you pretty much are required to use Rc (reference count)
+ RefCell (runtime bottow checker) for cross references or when
there isn't a single ownership. That means that Rust suddenly
becomes a garbage collected language + it must track borrow
checker in runtime because the compiler cannot know that during
compile time. This of course adds overhead code which I would
consider in many cases unnecessary.
More information about the Digitalmars-d