Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!cbatt!ihnp4!ptsfa!lll-lcc!styx!ames!rutgers!mit-eddie!genrad!decvax!tektronix!tekcrl!tekchips!stevev From: stevev@tekchips.UUCP Newsgroups: comp.lang.misc Subject: Re: OBJ2 and Smalltalk Message-ID: <1047@tekchips.TEK.COM> Date: Fri, 13-Feb-87 13:48:50 EST Article-I.D.: tekchips.1047 Posted: Fri Feb 13 13:48:50 1987 Date-Received: Sun, 15-Feb-87 04:48:39 EST References: <4000001@nucsrl.UUCP> <3288@milano.UUCP> <147@m10ux.UUCP> <277@figaro.STANFORD.EDU> Organization: Tektronix Inc., Beaverton, Or. Lines: 30 Keywords: Useful queues? Summary: copying arbitrary structures In article <277@figaro.STANFORD.EDU>, asente@figaro.STANFORD.EDU (Paul Asente) writes: > > This has been bothering me for some time. In addition to claiming the > ease of programming without having to specify types, advocates of > totally untyped systems (like Smalltalk) always dredge up the example of > having a queue (or stack or list...) that allows arbitrarily mixed > data to be enqueued. In all my years of programming I have never wanted > to do anything like this. I'd be interested in hearing from > > 1) anyone who had needed to do this or something similar > 2) anyone who thinks doing this is good programming style, or > 3) anyone who can come up with a better example of why unconstrained > polymorphism is a good thing in a language. I'm not a particular fan of unconstrained polymorphism, but one application in which it has been useful in Smalltalk is in writing out descriptions of a data structure to a file so that they can later be read back in. Since such structures might be circular, you have to keep track of what you've already seen. Having one data structure in which I can keep track of everything (regardless of class), rather than having a different Set for each class, made life quite a bit easier. A similar application is that of copying (possibly circular) structures. For each object that you've already seen, you want a data structure that keeps track of the mapping between "old" objects and "new" objects. Steve Vegdahl Computer Research Lab Tektronix Labs Beaverton, Oregon