[fpc-pascal] Re: operator overloading and counting references / creating / destoying anonymous instances
Jorge Aldo G. de F. Junior
jagfj80 at gmail.com
Sat Jul 30 20:33:11 CEST 2011
Imagine the following :
A -> C -> E
B -> D -> E
A is ref counted, and says that theres 10 references to the object C
B is ref counted, and says that theres 5 references to the object D
But both C and D points to the same object !
So now you have actually 15 references to the same object.
Lets say objects gone out of scope and C is now counted at 0 on A, what to do ?
Deallocate C causes E to be deallocated, but, what happens at B -> D ?
So what you need ?
A -> Singleton -> E
B -> Singleton -> E
In other words, make an object that stores all bignums and decides
when to allocate or deallocate then and work from that on.
More information about the fpc-pascal