Why: Because the GC knows exactly where the scope of the variable ends and thus can set it in the "clean list" for the current scope.
Its only a "real object" if it is transfered out of its scope and from that moment on its references are counted.
Multithreading wouldn't change due to that behavior. The GC is not multithreading save, that easy it is currently. It does not make any sense to try to implement it currently as you can not prevent the GC from trying to access the object to clean it. The GC would need to be replaced, from what I remember, some input has been given on that point by some experienced users in this area. Perhaps those things are implemented some day, as multithreading is definitely a must have. Systems are going 2 - 4 cores by default.
Returning refcount is currently possible. Not officially but through a little hack ( Byte Ptr(object)[-4] ). I agree that an official way to retrieve this count without the possibility to modify it would be a really good thing.
Only point I do not understand is how Object Ptr confuse the GC. They don't do it actually, the GC just ignores them. You have to manage it yourself and take care it is not pointing to a "dead" object, because the GC has no knowledge of them nor does it want to know of them as they bypass his handling system.
Or do I missunderstand what you are actually trying to say.
Its only a "real object" if it is transfered out of its scope and from that moment on its references are counted.
Multithreading wouldn't change due to that behavior. The GC is not multithreading save, that easy it is currently. It does not make any sense to try to implement it currently as you can not prevent the GC from trying to access the object to clean it. The GC would need to be replaced, from what I remember, some input has been given on that point by some experienced users in this area. Perhaps those things are implemented some day, as multithreading is definitely a must have. Systems are going 2 - 4 cores by default.
Returning refcount is currently possible. Not officially but through a little hack ( Byte Ptr(object)[-4] ). I agree that an official way to retrieve this count without the possibility to modify it would be a really good thing.
Only point I do not understand is how Object Ptr confuse the GC. They don't do it actually, the GC just ignores them. You have to manage it yourself and take care it is not pointing to a "dead" object, because the GC has no knowledge of them nor does it want to know of them as they bypass his handling system.
Or do I missunderstand what you are actually trying to say.