Xref: utzoo comp.lang.misc:7095 comp.object:2907 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!sdd.hp.com!spool.mu.edu!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: 27 Mar 91 03:48: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: 46 Nntp-Posting-Host: extro.ucc.su.oz.au kramden.acf.nyu.edu (Dan Bernstein) writes: > ... >So: What use can anyone make of a heterogeneous list? >---Dan Allow me to turn my previous posting into something more coherent. (I hate writing in UNIX editors) :-). I spend quite a lot of time working on system functions in a client's Options Trading System. They have a need to pass Smalltalk/V windows between workstations on a network. These windows are essentially applications. They are all different in structure and functionality. For example a portfolio browser. This browser is not just some buttons and bitmaps, it contains the full details of the portfolio and all associated objects. I wrote, some code to write arbitrary, perhaps recursivley defined objects, serially to a file or pipe. Because this tool has to work with classes and structures which evolve over time there is no way I can predict which classes the tool will have to deal with at any particular time. To manage repeated and recursive references to an object on output, I recursively traverse the structure of the object to unload, and enter each object into a dictionary as it is encountered. The key to the dictionary is the object itself. A HETEROGENEOUS DICTIONARY. The dictionary entry at each object is an integer identifier which denotes that object as the n'th object encountered on traversal. If I've seen the object before on traversal then I write its integer identifier to the output. This handles recursion and repetition. When loading the complex object from the Stream into Smalltalk on another workstation Each object is stored on the end of an OrderedCollection (A HETEROGENEOUS LIST) , when an integer identifier is encountered in the input Stream, I replace it with the object in the OrderedCollection indexed by that integer. The Dictionary and the OrderedCollection must be Heterogeneous for such a tool to work. Peter Goodall (Sorry about the repost)