Sorry everyone, I'm not going to be able to get to this until at least
Friday and probably not until next week.
The association mechanism isn't that big and is mostly built on top of
the core elephant other than some metaclass support. If someone wants
to look into it - the associations.lisp file and the metaclass.lisp
files have all you'd need to figure out what is going on.
Associations simply create and manage indices. The only magic is
intercepting slot reads/writes and updating the indices
appropriately. I don't doubt that there is likely to be corner cases
the code doesn't yet handle. A second (or third or fourth) pair of
eyes is likely to be very helpful here.
Ian
On Jul 22, 2008, at 6:00 AM, LukasGiessmann wrote:
hi,
i also tried to make a simple example of this situation and after a
while
i noticed the following behavior of the class A:
---
(defpclass A()
((id :initarg :id :accessor id-of :index t)
(points-to :accessor points-to :associate (A pointed-by) :many-to-
many t)
(pointed-by :accessor pointed-by :associate (A points-to) :many-to-
many
t)))
---
the association index of the slots points-to and pointed-by is the
same.
so i redefined the class:
---
(defpclass A()
((id :initarg :id :accessor id-of :index t)
(points-to :accessor points-to :associate (A points-to) :many-to-
many t)
(pointed-by :accessor pointed-by :associate (AnotherClass points-to)
:many-to-many t)))
---
afterwards i made 2 instances of the new definition and checked the
indices and they were not equal.
finally i defined the original class A and made the directed
associations,
it worked.
there's also the original file attached, with the exact program
sequence.
regards
lukas
Hi,
we came across a (to us) surprising behavior of the association
code in
elephant-unstable: If we generate associations between instances of
the
same
class, then elephant forces these associations to be symmetric.
That means
we
cannot use association slots to implement directed graphs.
For example, the attached program is supposed to set up a
"diamond"; We'd
therefore expect the following output:
Node A:
successors: (B C)
predecessors: ()
Node B:
successors: (D)
predecessors: (A)
Node C:
successors: (D)
predecessors: (A)
Node D:
successors: ()
predecessors: (B C)
However, elephant makes both the successor and the predecessor slot
hold
always the same references:
Node A:
successors: (B C)
predecessors: (B C)
Node B:
successors: (A D)
predecessors: (A D)
Node C:
successors: (A D)
predecessors: (A D)
Node D:
successors: (B C)
predecessors: (B C)
Is this by design or is this a bug? Or did we simply use the
association
API
incorrectly?
Regards
Christoph
--
FH Worms - University of Applied Sciences
Fachbereich Informatik / Telekommunikation
Erenburgerstr. 19, 67549 Worms, Germany
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel
<
directed_graph_works
.lisp>_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel