[elephant-devel] associations between instances of the same class
Ian Eslick
eslick at media.mit.edu
Wed Jul 23 18:44:23 UTC 2008
Great, thanks! I just pushed this to elephant-unstable. Typically a
gzip of a darcs patch (created with the vanilla darcs send -o) is
good. Mail tends to screwup plaintext patches. This was small enough
I just did it by hand; hopefully it doesn't conflict with your patch
when you pull it from the repository.
Cheers,
Ian
On Jul 23, 2008, at 12:49 PM, Christoph Ludwig wrote:
> Hi,
>
> the attached patch solves the problem with the "forgotten"
> associations. The
> main reason for the problem was that the slot index was incorrectly
> named in
> the controller-index-table of the store controller.
>
> Is this patch format ok? We are admittedly all but darcs experts.
>
> Regards
>
> Lukas, Marc & Christoph
>
>
> On Tue, Jul 22, 2008 at 08:17:21AM -0400, Ian Eslick wrote:
>> 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
>>>>
>>> <directed_graph_works
>>> .lisp>_______________________________________________
>>> elephant-devel site list
>>> elephant-devel at common-lisp.net
>>> http://common-lisp.net/mailman/listinfo/elephant-devel
>>
>> _______________________________________________
>> elephant-devel site list
>> elephant-devel at common-lisp.net
>> http://common-lisp.net/mailman/listinfo/elephant-devel
>>
>
> --
> FH Worms - University of Applied Sciences
> Fachbereich Informatik / Telekommunikation
> Erenburgerstr. 19, 67549 Worms, Germany
> <elephant-slot-
> index.patch>_______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel
More information about the elephant-devel
mailing list