Newsgroups: comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!nntp.club.cc.cmu.edu!goldenapple.srv.cs.cmu.edu!rochester!udel-eecis!gatech!csulb.edu!hammer.uoregon.edu!news-xfer.netaxs.com!cpk-news-hub1.bbnplanet.com!news.bbnplanet.com!ais.net!news.stealth.net!uunet!in2.uu.net!uucp3.uu.net!world!carlg
From: carlg@world.std.com (Carl E Gundel)
Subject: Re: = and ==
Message-ID: <E89pzo.KC8@world.std.com>
Organization: The World, Public Access Internet, Brookline, MA
X-Newsreader: TIN [version 1.2 PL2]
References: <334532E2.10C8@fedex.com> <33453E7A.5CE@fedex.com>
Date: Mon, 7 Apr 1997 12:43:00 GMT
Lines: 33

Eric Wessbecker (ewess@fedex.com) wrote:
: In your above example you did not impliment you used two symbols.  Their
: = method is 
: ^self == anObject.  == means that they are the same object.  In your
: dictionary you have two different symbol objects, they are not ==(They
: do not share the same pointer).  If you want objects to be = based on
: components you must set the parameters.  Here is a little example.  

This is incorrect.  Unlike instances of class String, instances of Symbol
are unique.  You cannot have more than one Symbol containing the a
particular string of characters, so like symbols will *always* return true
when tested for equality because they are in fact the same symbol and
share a single object pointer. For example, evaluate the following
different lines of code:

  "The following will return true."
  #testMe == #testMe

  "The following will return false."
  'testMe' == 'testMe'

As for why the two dictionaries do not return true when tested for
equivalency using =, I would suspect that the = method inherited by
Dictionary is too general to provide the result that Yu Chen expected.  I
wouldn't even think it safe to assume that = behaves in the same way for
instances of Dictionary from one vendor's version of Smalltalk to another. 

Carl
-- 
------------------------------------------------------------------
 Carl Gundel  carlg@world.std.com  Shoptalk Systems  508-872-5315
 author of Liberty BASIC, a 1996 PC Magazine Awards Finalist!
 http://world.std.com/~carlg/basic.html
