On Tuesday, 27 April 2021 at 15:23:30 UTC, sighoya wrote:>
Without to be invited too much in the details here, I think you are right. But how should a stdlib look like which abstract over all allocators, would it be safe can it be safe and performant and generalizing?
I mean RC, for instance, is inferior in what it can accept for a language/what it can manage safely compared to GC.
So in return, some algorithms may only work for a GC.
This can be solved by not allowing destructors/finalizers on GC objects. Then a modelling error would only lead to leaks.
If you do that then you can let libraries be written for RC. Then when a GC is available you convert strong and weak RC-pointers to non-RC pointers if the RC-pointer pointed to a class with no destructors/finalizers.
But since people won't give up on destructors/finalizers for GC, we can't do this. The alternatives are likely to be bug ridden...
So, people who want libraries to be memory management agnostic actually have to successfully champion that destructors/finalizers are removed from the GC for all programs.
Get consensus for that, then move on to getting rid of the GC from libraries. First thing first.