[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gambas-devel
Subject:    Re: [Gambas-devel] Multi-level virtual objects, inheritance and symbol resolution mess
From:       Tobias Boege <taboege () gmail ! com>
Date:       2014-09-13 3:05:33
Message-ID: 20140913030533.GE976 () aurora
[Download RAW message or body]

On Sat, 06 Sep 2014, Beno?t Minisini wrote:
> But there is another problem:
> 
> hGraphMatrix.Vertices[] calls GraphVertices_get, which calls the 
> "_getVertex" method. As "_getVertex" returns a "virtual object", no 
> dynamic calling can occur, and the InDegree property of _Graph_Vertex is 
> called, never the InDegree property of _Matrix_Vertex.
> 
> I have no solution at the moment...
> 

In #6468, for native classes, I circumvented it by overriding the "Vertices"
symbol in the graph class:

  GB_PROPERTY_SELF("Vertices", ".Matrix.Vertices")

where it was previously inherited from the common Graph class as a
".Graph.Vertices". This way I can say in the description of .Matrix.Vertices
that the _get() method returns a .Matrix.Vertex instead of the .Graph.Vertex.
Then the right methods are called.

For Gambas classes, this won't work at all because it involved inheriting
virtual classes (impossible) and staying a virtual class in this course
(also impossible). So I thought I would just give .Graph.Vertex _property
and _unknown methods and mirror them, again, to _vertexProperty and
_vertexUnknown in the graph class.

It is yet another indirection but it's for Gambas graphs only and there
shouldn't be too many things a person wants to add to a vertex or edge
class.

Seems like the way it is now, everything is working and it doesn't seem too
hard to implement a graph in Gambas. I'll write a tutorial on how to do it,
if you're as content as you can be with the system.

I'll send three test projects to gambas-user in a minute.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

------------------------------------------------------------------------------
Want excitement?
Manually upgrade your production database.
When you want reliability, choose Perforce
Perforce version control. Predictably reliable.
http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-devel mailing list
Gambas-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic