Re: suggestions for newbee
Daniel Bonniot <[email protected]> Thu, 07 Jul 2005 11:49:54 +0200
| Newsgroups | gmane.comp.lang.nice.general |
|---|---|
| Message-ID | <[email protected]> |
> I'm a little confused here. I understand the need for identity. But my > understanding is that DeepEquals means that these two objects and their > constituent objects are DeepEquals all the way down to primitives where they > have the same content. What then is ShallowEquatable? Is it a object who that > is ether the same identity or is different but who's sub-elements are the > same instances? If so is there any reasonable occasion where this would be > preferred to DeepEquals for reasons other than performance? Yes, I think this is the meaning of shallow. I am indeed not sure how useful it is in practice. A guess is that it's interesting because it avoids the problems of deep equality when there are cycles. It's also used in the context of copying, which is maybe more useful in practice: a shallow copy of a list is a new list with identical elements (useful if lists are modifiable). > In such a case it > would seem preferable to make DeepEquals "equals" and to define > "shallowEquals" where it is needed. The idea was to generate different implementations of equals depending on the interface implemented. Of course using different names is also possible. I'm not really sure if this is important and which style would be most useful, so I'm waiting for feedback. BTW, would it make sense to handle deep equality with cycles by using some marking (hashtable)? Daniel ------------------------------------------------------- SF.Net email is sponsored by: Discover Easy Linux Migration Strategies from IBM. Find simple to follow Roadmaps, straightforward articles, informative Webcasts and more! Get everything you need to get up to speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click