Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!bu.edu!wang!news From: marcs@slc.com (Marc San Soucie) Newsgroups: comp.lang.misc Subject: Re: CHALLENGE: heterogeneous collections Message-ID: Date: 29 Mar 91 21:54:34 GMT References: Sender: news@wang.com Organization: Servio Corporation Lines: 47 Joseph Pallas writes: > In objtch@extro.ucc.su.oz.au (Peter Goodall) > writes about a collection of Objects in Smalltalk. But a collection > of Objects is not a heterogeneous collection. This may be a little > confusing because Object is a universal supertype in Smalltalk. > > Let's be concrete: > > A heterogeneous collection is one for which no single type can be > safely assigned to all members of the collection. > > If all of the members of the collection have some common supertype, > AND no operation is performed on any member of the collection that is > not valid for that common supertype, then the collection is a > homogeneous collection of members of that supertype. > > So if you have a collection of objects, you have to do something to > those objects that you can't safely do to Objects in order to have a > heterogeneous collection. This is pretty left-field thinking. A collection is an entity, not an activity. The collection exists regardless of what you do or whether you do anything with it. So argue the definition of the entity, not the operations that are to be performed on it or its members. Yes, in Smalltalk there is a base class from which everything inherits, so yes, you can claim that in Smalltalk there cannot ever be a truly heterogeneous collection. So in C++ every object is a bunch of bytes. Big deal. How about a more accurate but possibly meaningless definition of a heterogeneous collection: A collection on the types of whose members there are no explicit constraints. From which derives the possibly equally meaningless theorem: It is easier to construct such a collection in a Smalltalk-like language than in a C++-like language. Which leads me to wonder: Can this discussion lead to any meaningful insights? Marc San Soucie Servio Corporation Beaverton, Oregon marcs@slc.com