Amazing news. So, NIM gets pony-ized (a very little bit) and this seems to be a 
wise decision. Well, the `owned ref` initially is Pony's `iso` indeed and can 
be used accordingly, e.g. can be passed to another thread. For the moment, I 
can only guess but lets try.... The preferred (deterministic) time for 
deallocation is reached when the `owned ref` leaves the scope. With 
Bacon-Dingle, any refcount in the deallocation candidate has to be zero. If 
not, Bacon/Dingle would rise a runtime error, because there has to be (at least 
one) "dangling pointer" elsewhere. But it's not B/D.... so the deallocation 
needs to be done later, needs to be postponed. Therefore, the refcount needs to 
be altered, e.g. with a bit, or, possibly, decremented by one. When the 
"faulty" reference gets gc'ed itself, it will see the marked refcount or simply 
see a zero refcount and the deallocation will happen then., in fact completing 
the (postponed) deallocation. Only mem structures without "dangling" refcounts 
may be passed to other threads. This can be checked at runtime, restating the 
`iso` property of the mem structure. This is more flexible than Pony's approach 
(relying entirely on static checks) . Eventually, NIM could adopt that strategy 
too, allowing for further optimizations. 

Reply via email to