Behavior methods

Vassili Bykov vassili at objectpeople.com
Tue Jun 16 21:16:06 UTC 1998


At 12:03 AM 6/17/98 +0300, Boris G. Chr. Shingarov wrote:
>(This is not exactly what is in IBM Smalltalk where allInstances
>returns an OrderedCollection, contrast to Set in Squeak.  I think
>it should be Set there - but maybe someone knows any specific
>reason for OC??)

The motivation behind the choice might be the array vs. hash table
implementation rather than ordered vs. unordered property of the
collection.  An arrayed collection is cheaper storage-wise (at least if you
use it properly), and adding objects to it is faster--there is no hash code
calculation, no search for a free slot in a hash bucket, and no rehashing
after growing.  So if a collection is created primarily for the sake of
iterating over it later, rather than testing for membership using
#includes:, an OC may be a better choice than a Set.  (Actually, #includes:
on a small OC may be faster than on a Set with same elements).

--Vassili

-- 
Vassili Bykov         vassili at objectpeople.com
The Object People     http://www.objectpeople.com
+1(613)225-8812
  "Any sufficiently complicated C or Fortran program contains an ad hoc
  informally-specified bug-ridden slow implementation of half of Common Lisp."
    -- Greenspun's Tenth Rule of Programming





More information about the Squeak-dev mailing list