Xref: utzoo comp.lang.misc:7395 comp.object:3149 Path: utzoo!censor!geac!lethe!tvcent!comspec!telly!attcan!uunet!munnari.oz.au!metro!extro!objtch From: objtch@extro.ucc.su.oz.au (Peter Goodall) Newsgroups: comp.lang.misc,comp.object Subject: Re: CHALLENGE: heterogeneous collections Message-ID: Date: 26 Mar 91 22:20:43 GMT References: <1991Mar22.210725.29448@neon.S <1991Mar25.220525.11087@leland.Stanford.EDU> <26714:Mar2602:52:1891@kramden.acf.nyu.edu> Sender: news@metro.ucc.su.OZ.AU Organization: Sydney University Computing Service, Sydney, NSW, Australia Lines: 32 Nntp-Posting-Host: extro.ucc.su.oz.au brnstnd@kramden.acf.nyu.edu (Dan Bernstein) writes: > ... >So: What use can anyone make of a heterogeneous list? >---Dan I have written a Smalltalk application which will unload fairly arbitary recursive objects to an append only Stream (pipe). We use this for spitting windows and their contents between workstations on a network. There is no way of knowing the contents of a window structure because they are very dynamic. When I write the structure out to a file I keep a heterogeneous Dictionary which has as keys each object encountered as the structure is traversed. The valu in the dictionary at an object is a unique number from a counter. So, if I find a new object, I increment the counter and store its value in the dictionary at the new object. Each time I encounter an object in the traversal I check the dictionary if it is already there I put its unique integer in the output stream. When I load a structure from a stream into the curent image I put each object as I re-create it into a heterogeneous list. It's index in this list is the unique number assigned in the output dictionary. When I encounter a reference number on input replace it with inputListAt: anInteger. While the structure of this text may not be too good. I believe this is an application where heterogeneous maniplulation of objects is essential. Peter Goodall