Thomas Beale wrote:
> Tim Cook wrote:
>>
>> For example in IArchetype (the Archetype interface) I define ontology as
>> an ArchetypeOntology type. Now Archetype of course is supposed to
>> implement IArchetype. IArchetypeOntology defines parentArchetype as an
>> Archetype type. This creates a circular dependency when the interfaces
>> try to create a datatype based on a class that depends on itself.
>
> 2 the difference between circular references in the object model, and
> circular references in instances graphs. ...
>
> 3. a self-reference in the class model, such as for DV_MULTIMEDIA
> doesn't necessarily mean a circular reference in an instance graph (and
> it doesn't in this case) ...
Now I need to be clear about something ;-)
I'm 99% certain, Thomas, that Tim is talking about circular references in
the class model, not in the instance graph.
Eiffel seamlessly lets classes reference each other, but some languages
can't cope with it as easily. First thing is, Tim has done the mind-body
split thing, writing an interface for each class. That's fine. But his
problem is this:
Archetype
--- implements --->
IArchetype:
ontology: IArchetypeOntology
IArchetypeOntology:
parentArchetype: Archetype
So he has Archetype depends on IArchetype depends on IArchetypOntology
depends on Archetype depends on IArchetype depends on ... ad infinitum.
Apparently it gives the Python interpreter an apoplexy when it tries to
resolve references that it has discovered yet. But as I mentioned in my
earlier email, a bit of googling suggests that Python does have ways of
working around this.
Let's see what Tim thinks.
- Peter