Wow, that's a hairy problem. I just read the
thread a few minutes ago. I agree that using a description does not solve the problem. But
if I'm not wrong then the problem exists for every object where
anObject copy == anObject
right?
Yeah, the problem is complex.
And I am tempted to avoid it by not going deeply into the graph, but
by only validating what would be visible (if for example rendered by
Seaside). This was the case a few years back, but then somebody
complained about incomplete validation of 1:1 and 1:n relationships.
Now I do not remember exactly why we changed this, but it seems to me
the cause of all problems :-)
(Btw. is there a selector in Smalltalk that can test
this?)
I don't think so. The code you wrote is probably the only test.
On the other hand we are talking about preventing
infinite loops, right? Is there a chance that any of the objects that meet the condition
above can trigger an infinite recursion? I don't think so.
Correct, but there can be other cases.
Imagine multiple 1:1 relationships where the same some of them refer
to the same object, but have different validation conditions.
Similarly, as we saw before, we can have different objects with the
same description instances.
Lukas
So it should be sufficient to manage the seen list
only for the object that do no meet the condition. Although the above is neither nice nor
fast.
Norbert
On 12.10.2010, at 08:14, Lukas Renggli wrote:
I thought about that too, but this is not a
solution: It can be that
different objects are described with the same description instances.
Lukas
On 12 October 2010 02:46, John McKeon <p3anoman(a)gmail.com> wrote:
I've posted a mcz
to
http://code.google.com/p/magritte-metamodel/issues/detail?id=7
It uses the description instead of the object in the collection of
descriptions already visited
John
On Mon, Oct 11, 2010 at 6:11 AM, Lukas Renggli <renggli(a)gmail.com> wrote:
That just remembers (in 'previous') and restores the currently
validated object while (in 'object') recursively walking through the
graph (which is a tree in 99% of the cases).
Lukas
On 11 October 2010 12:05, Nick Ager <nick.ager(a)gmail.com> wrote:
>
>
> On 11 October 2010 10:53, Lukas Renggli <renggli(a)gmail.com> wrote:
>>
>>> (seen includes: anObject)
>>> ifTrue: [ ^ self ].
>>> anObject isNil
>>> ifFalse: [ seen add: anObject ].
>>
>> That part just tries to avoid to go into recursion if a described
>> object refers to another object that descriptions refer back to the
>> original object. That was requested at some point in the past, but I
>> never dependent on that myself.
>
> I understood that part but don't understand the intent of:
> previous := object. object := anObject.
> aBlock ensure: [ object := previous ]
> _______________________________________________
> Magritte, Pier and Related Tools ...
>
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
>
--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
--
http://john-mckeon.us
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
_______________________________________________
Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
--
Lukas Renggli
www.lukas-renggli.ch