Namespaces not cleaned?
by Xavier "eXoDuS" Amado · in Torque Game Engine · 10/01/2003 (10:49 pm) · 10 replies
I'm having some trouble regarding name spaces. I'll explain with an example
Anyone has any information on this?
Thanks.
new ScriptObject(Test) {
class = TestClass;
}
Test.delete();
new ScriptObject(Test) {
class = AnotherTestClass;
}Doing something with the structure from the above gives an error when creating the Test object again the second time, the error says that I'm trying to re-link from namespace "TestClass" to "AnotherTestClass". This sounds fairly stupid since I've already deleted the object, and I *did* check to see if the object was really deleted and it was. I even tried adding a second of lapsus between the deletion and the creating but still no go.Anyone has any information on this?
Thanks.
About the author
#2
Thanks for the information. Wonder what the hell... was changed... thinking thinking... I remember a change about script namespaces ... but I dont remember when. I'll check the changeLog in the morning. I'm sleeping now..
10/01/2003 (11:18 pm)
Oh!, That's interesting!Thanks for the information. Wonder what the hell... was changed... thinking thinking... I remember a change about script namespaces ... but I dont remember when. I'll check the changeLog in the morning. I'm sleeping now..
#3
10/01/2003 (11:28 pm)
It used to not create a namespace for your object name.. it HEAD it does this now :)
#4
I should probably add reference counting to namespace parent links. That was initially planned, but never got implemented.
I'll look at it once I get into the office.
10/02/2003 (7:16 am)
Hmm...I should probably add reference counting to namespace parent links. That was initially planned, but never got implemented.
I'll look at it once I get into the office.
#5
10/02/2003 (7:46 am)
@Mark: Reference counting? Care to explain a bit?
#6
Does that make it any more clear? :)
10/02/2003 (9:31 am)
Well, basically, each namespace would track how many times it is linked to its parent namespace. So all the builtin classes would start with a linkCount of 1, from the IMPLEMENT_CONOBJECT macro/Parent typedef magic. Then any declared object could link in a "subclass". When that object gets deleted, it would call unlinkNamespace, which would decrement the link count. If the link count went to 0, you'd then be able to link that named object into a different namespace.Does that make it any more clear? :)
#7
That or removing the creation of namespaces for object names (scriptObjects)... not sure why we should have such a thing anyway
10/02/2003 (1:00 pm)
Yes! A lot more. Thanks, I get what you mean now, and yes that's a good thing to do.That or removing the creation of namespaces for object names (scriptObjects)... not sure why we should have such a thing anyway
#8
I was going to implement a ref counting scheme, but with the packages it makes the parent linkage really hairy, and I just don't want to mess with it.
- Mark
10/02/2003 (1:46 pm)
Ok, I partially fixed this. It won't assert anymore (good) and it won't ever link an object into a namespace that's not a subclass of the object's namespace (also good). But it won't currently clean them up, so basically, don't create two named script objects with the same name and different parent classes.I was going to implement a ref counting scheme, but with the packages it makes the parent linkage really hairy, and I just don't want to mess with it.
- Mark
#9
Thanks mark.
10/02/2003 (5:19 pm)
Uh oh... but I *need* to create two objects with the same name... since I'm always going to access _that_ object but I want it to do different things... guess I'll have to come with a way around it...Thanks mark.
#10
10/02/2003 (7:51 pm)
Ok I adressed my problem by creating a global variable called that pointed to the different objects I created so that I could still use one value to access any of them as the same thing.
Torque Owner Christian M Weber