Identity and Inheritance was: (Re: [BUG] Set>>collect:)

Richard A. O'Keefe ok at cs.otago.ac.nz
Mon Feb 17 00:17:19 UTC 2003


Bill Spight <bspight at pacbell.net> wrote:
	In this discussion it has struck me that IdentitySet, although
	it is a child of Set, is a generalization of it, since it allows
	elements that Set does not.  Maybe it should not inherit from Set, but
	the other way around.
	
Inheritance in Smalltalk is primarily about code reuse, NOT generalisation.

It is not really true that IdentitySet is a generalisation of Set;
what it does with the elements is different from what Set does.

In a generalisation/specialisation sense,
the hierarchy should be

   Collection
    <Generic Set>	"missing"
      Set
      IdentitySet
      PluggableSet
    <Generic Bag>	"missing"
      Bag
      IdentityBag
      PluggableBag	"missing"
    <Generic Dictionary>"missing"
      Dictionary
      IdentityDictionary
      PluggableDictionary
      
If Smalltalk inheritance was about generalisation/specialisation,
we wouldn't have Dictionary inheriting from Set.



More information about the Squeak-dev mailing list