[Gambas-devel] Multi-level virtual objects, inheritance and symbol resolution mess

Benoît Minisini gambas at ...1...
Wed Sep 10 23:43:35 CEST 2014


Le 10/09/2014 23:07, Tobias Boege a écrit :
> On Wed, 10 Sep 2014, Beno?t Minisini wrote:
>> Le 06/09/2014 17:50, Beno?t Minisini a ?crit :
>>>
>>> OK. As I thought, the "_" prefix was the problem. I fixed the
>>> interpreter so that it decides that a native class is virtual by taking
>>> into account the "GB_VIRTUAL_CLASS()" declaration, not just the initial
>>> dot in the name.
>>>
>>> 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...
>>>
>>
>> Hi Tobias,
>>
>> Did you succeed in dealing with that tricky stuff?
>>
>
> Oh, I just remembered the one thing which made me give up the last night I
> tried to make progress on this:
>
> With the former implementation I had a Graph and a _Graph_Vertex class which
> both contained methods on their own and this separation was a good thing.
> Now, to get the function pointers together, I would need all special
> functions be implemented in the graph class alone, like _nextAdjacent which
> enumerates vertices adjacent to the currently selected virtual .Graph.Vertex
> object... Not so pretty. It would make the .Graph.Vertex and .Graph.Edge
> classes useless because all the information needs to be in the graph class
> anyway in order to implement those special methods.
>
> I could require the user to name their descendent of .Graph.Vertex -- if
> their main graph class is called MyGraph --, as .MyGraph.Vertex and then
> search this class explicitely.
>
> What do you say?
>

I say that I'm not shocked if the entire interface is in the Graph 
class. But I don't see why you can't keep .Graph.Vertex and .Graph.Edge. 
The user just won't have to inherit them anymore.

Regards,

-- 
Benoît Minisini




More information about the Devel mailing list