Rant time? Rant time.

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Tue Sep 22 11:01:53 UTC 2020

On Tuesday, 22 September 2020 at 10:30:38 UTC, IGotD- wrote:
> 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 reference.

Yes, certainly. If an actor is no longer live then all isolated 
(non-shared memory) objects could be released in one go, like 
just freeing up the entire pool if that actor did all the local 
allocations from a single local pool. (I believe Pony to have 
global garbage collection though.)

So the challenge is coming up with protocols that allow library 
metaprogramming code to communicate to the static analysis what 
actually is going on. And some very specific requirements that 
makes behaviour undefined if the protocols are broken has to be 
established by the language spec in very clear terms.

I am not sure how this can be done in detail, but it probably is 
a research topic that is active (or overlap with current PL 
research). So one probably should aim low, or at least very 
focused on known issues, like establishing a protocol that allow 
swift-like reference counting with optimization, or arena-like 
allocators where you can just dump the entire arena-pool if all 
objects allocated from that pool have no destructors that have 
side-effects outside the pool.

Just as an example: a set of graphs where each graph has a 
separate pool and the compiler can prove that all nodes in a 
graph is only comping from that graph-local pool. Then destroying 
that graph should not have to involve destructing nodes in the 
graph if they don't have side-effects outside the graph.

Coming up with a protocol to give the compiler those facts in the 
best way is a significant challenge and it should also be 
possible for the library author to aid the static analysis so 
that the static analysis become more efficient (keep the search 
more limited).

Lots of challenges here, and application authors should ideally 
not have to deal with this in the main "business" logic of the 
program. Hopefully it can be contained in libraries.

More information about the Digitalmars-d mailing list