Behavior methods

Vassili Bykov vassili at objectpeople.com
Fri Jun 19 11:29:16 UTC 1998


Eliot & Linda writes:
 > Boris G. Chr. Shingarov wrote:
 > > 
 > > sqrmax at cvtci.com.ar wrote:
 > > 
 > > > I've found faster implementations for four methods of Behaviour. Maybe
 > > > they're worth an update item. Two of the speedups are fourfold!
 > > 
 > > The IBM implementation is almost as fast but is more elegant:
 > > 
 > > Behavior>>allInstances
 > >    | aSet |
 > >    aSet := Set new.
 > >    self allSubclassesDo: [ :sub | aSet add: sub ].
 > >    ^aSet
 > 
 > But this implementation is totally incorrect.  It returns a Set of
 > objects that are not #= to each other, not an IdentitySet of objects
 > that are not #== to each other.  So if you use this to return all
 > instances it will frequently return a subset of all instances.

Boris probably meant #allSubclasses rather than #allInstances, at
least the body of the method produces just that.

--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