www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Object references and Interfaces

I'm having some big issues with references with this XML DOM stuff I'm 
working on... but I can't put my finger on the root of the problem.  I 
posted to the bugs NG about one of the symptoms "=== No Damn Good", but 
now I'm running into other issues.

For starters, everything has an interface, and that's how they are used. 
  On the surface, this appears to work.  Now, one of my Interfaces 
(called "Node") has a property method "NamedNodeMap attributes()". 
NamedNodeMap is an interface.  The classes that implements the 
interfaces are called "NodeImpl", and "NamedNodeMapImpl".

When I call the attributes() method from within the class (or one of 
it's subclasses), and then call, say, the length() method on the 
NamedNodeMap when there's some data in it, it gives me the correct result.

Later, in interfacing with the library, I do something like:
Node node = ...// wherever I got it from
node.dump(); //This method shows the attributes amoung other things- so
	//I know that they're in there somewhere
printf("%3d\n\0", node.attributes.length);
And I'll get an output of "0" from last printf.

When I printf the pointers to the attribute object, I get different 
numbers... I'm not sure if this is correct.  As near as I can tell, 
after construction of the tree, more NamedNodeMaps aren't being created, 
so I don't have a clue what's going on.

I'm 99% sure there is a BIG, FAT, ANNOYING compiler bug to blame for this.

Has anyone else encountered issues like these?

I was able to get around the === thing, but I haven't found a HACK to 
get AROUND this bug yet.

Since you've made it this far, thanks for reading my venting... this 
one's been consistently annoying on this project.

John
Jan 28 2005