Re: Comparing DS_HASH_TABLE objects
Bernd Schoeller <[email protected]> Fri, 5 Jun 2009 09:37:12 +0200
| Newsgroups | gmane.comp.lang.eiffel.gobo.general |
|---|---|
| Message-ID | <[email protected]> |
Hi everybody,
Had to catch up to this interesting discussion. Just want to add my 5
cents:
Eric is perfectly right that there are many ways to compare objects
and is_equal is just one of them. "Pure" object-orientation has just a
single native equality and that is reference equality. All other
equalities are artificial.
There was a discussion on removing is_equal from ANY in ECMA. The
reason it was left in (including the cat-call prone signature) is:
expanded types.
IMHO, 'is_equal' and 'copy' are both in ANY for the only(!) reason
that they are needed when the semantics of ":=" and "=" changes for
expanded types. Reference assignment and comparison are not working
anymore in that case.
Being aware of this, using 'is_equal' and 'copy' should be avoided
whenever you are working with reference objects. Unfortunately, this
fact is ignored in most Eiffel libraries. That '~' is defined in terms
of 'is_equal' in ECMA continues this mess. I think using ~ should be
avoided, too.
Bernd
On Jun 5, 2009, at 2:35 AM, Helmut Brandl wrote:
>
>
> Peter Gummer wrote:
> > Helmut Brandl wrote:
> >> Exactly. I would like to have to most natural operator to express
> object
> >> equality. And that is "=". I guess in the majority of the cases
> the user
> >> wants to test object equality and not reference equality.
> >>
> >> But this is a theoretical wish. Nobody will accept such a
> discussion.
> >> The argument with backward compatibility kills everything in that
> direction.
> >>
> >
> > True, but it's fun to dream of what Eiffel++ might look like ;-)
>
> I am glad that there a persons out thinking about beyond ECMA.
>
> >
> > Following this logic through, we should change the assignment
> operator
> > to perform copy semantics for reference types, so that a := b would
> > perform what we today write as a := b.twin. This is becoming a bit
> scary.
>
> I am not sure if I would go so far. Why do you use a := b.twin?
> Usually
> this is not necessary.
>
> But I would use is_deep_equal and deep_twin as a default for is_equal
> and twin. The flat twin is not very meaningful in most of the cases.
>
> Helmut
>
>
>
> <!-- #ygrp-mkp{ border: 1px solid #d8d8d8; font-family: Arial;
> margin: 14px 0px; padding: 0px 14px; } #ygrp-mkp hr{ border: 1px
> solid #d8d8d8; } #ygrp-mkp #hd{ color: #628c2a; font-size: 85%; font-
> weight: bold; line-height: 122%; margin: 10px 0px; } #ygrp-mkp
> #ads{ margin-bottom: 10px; } #ygrp-mkp .ad{ padding: 0 0; } #ygrp-
> mkp .ad a{ color: #0000ff; text-decoration: none; } --> <!-- #ygrp-
> sponsor #ygrp-lc{ font-family: Arial; } #ygrp-sponsor #ygrp-lc
> #hd{ margin: 10px 0px; font-weight: bold; font-size: 78%; line-
> height: 122%; } #ygrp-sponsor #ygrp-lc .ad{ margin-bottom: 10px;
> padding: 0 0; } --> <!-- #ygrp-mlmsg {font-size:13px; font-family:
> arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small;}
> #ygrp-mlmsg table {font-size:inherit;font:100%;} #ygrp-mlmsg select,
> input, textarea {font:99% arial,helvetica,clean,sans-serif;} #ygrp-
> mlmsg pre, code {font:115% monospace;*font-size:100%;} #ygrp-mlmsg *
> {line-height:1.22em;} #ygrp-text{ font-family: Georgia; } #ygrp-text
> p{ margin: 0 0 1em 0; } dd.last p a { font-family: Verdana; font-
> weight: bold; } #ygrp-vitnav{ padding-top: 10px; font-family:
> Verdana; font-size: 77%; margin: 0; } #ygrp-vitnav a{ padding: 0
> 1px; } #ygrp-mlmsg #logo{ padding-bottom: 10px; } #ygrp-reco
> { margin-bottom: 20px; padding: 0px; } #ygrp-reco #reco-head { font-
> weight: bold; color: #ff7900; } #reco-category{ font-size: 77%; }
> #reco-desc{ font-size: 77%; } #ygrp-vital a{ text-decoration:
> none; } #ygrp-vital a:hover{ text-decoration: underline; } #ygrp-
> sponsor #ov ul{ padding: 0 0 0 8px; margin: 0; } #ygrp-sponsor #ov
> li{ list-style-type: square; padding: 6px 0; font-size: 77%; } #ygrp-
> sponsor #ov li a{ text-decoration: none; font-size: 130%; } #ygrp-
> sponsor #nc{ background-color: #eee; margin-bottom: 20px; padding: 0
> 8px; } #ygrp-sponsor .ad{ padding: 8px 0; } #ygrp-sponsor .ad
> #hd1{ font-family: Arial; font-weight: bold; color: #628c2a; font-
> size: 100%; line-height: 122%; } #ygrp-sponsor .ad a{ text-
> decoration: none; } #ygrp-sponsor .ad a:hover{ text-decoration:
> underline; } #ygrp-sponsor .ad p{ margin: 0; font-weight: normal;
> color: #000000; } o{font-size: 0; } .MsoNormal{ margin: 0 0 0 0; }
> #ygrp-text tt{ font-size: 120%; } blockquote{margin: 0 0 0
> 4px;} .replbq{margin:4} dd.last p span { margin-right: 10px; font-
> family: Verdana; font-weight: bold; } dd.last p span.yshortcuts
> { margin-right: 0; } div.photo-title a, div.photo-title a:active,
> div.photo-title a:hover, div.photo-title a:visited { text-
> decoration: none; } div.file-title a, div.file-title a:active,
> div.file-title a:hover, div.file-title a:visited { text-decoration:
> none; } #ygrp-msg p#attach-count { clear: both; padding: 15px 0 3px
> 0; overflow: hidden; } #ygrp-msg p#attach-count span { color:
> #1E66AE; font-weight: bold; } div#ygrp-mlmsg #ygrp-msg p a
> span.yshortcuts { font-family: Verdana; font-size: 10px; font-
> weight: normal; } #ygrp-msg p a { font-family: Verdana; font-size:
> 10px; } #ygrp-mlmsg a { color: #1E66AE; } div.attach-table div div a
> { text-decoration: none; } div.attach-table { width: 400px; } -->
--
Bernd Schoeller, PhD, CTO, Partner
Comerge AG, Technoparkstrasse 1, CH-8055 Zurich, www.comerge.net
------------------------------------
To Post a message, send it to: [email protected]
To Unsubscribe, send a blank message to: [email protected]! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/gobo-eiffel/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/gobo-eiffel/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/