Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!rutgers!im4u!ut-sally!utah-cs!shebs From: shebs@utah-cs.UUCP Newsgroups: comp.lang.misc Subject: Re: OBJ2 and Smalltalk Message-ID: <4255@utah-cs.UUCP> Date: Tue, 3-Feb-87 10:50:57 EST Article-I.D.: utah-cs.4255 Posted: Tue Feb 3 10:50:57 1987 Date-Received: Wed, 4-Feb-87 04:09:17 EST References: <4000001@nucsrl.UUCP> <3288@milano.UUCP> Reply-To: shebs@utah-cs.UUCP (Stanley Shebs) Organization: PASS Research Group Lines: 41 Keywords: Useful queues? In article <277@figaro.STANFORD.EDU> asente@figaro.UUCP (Paul Asente) writes: >... 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. If you've ever used a variant record in Pascal or pointer tricks in C or equivalences in Fortran, you've wanted polymorphism. If you've ever used numbers in specified ranges as tokens with various meanings, you've wanted polymorphism ("0-3 means a disk channel, while larger numbers are ttys." "Negative numbers indicate error conditions, while positive ones are answers."). A couple situations extracted from recent programming tasks: Writing an machine-independent assembler, I needed to flag certain addresses as relocatable, others as references to functions, and so forth, to be recognized by the object file writer. The buffer passed between the assembler and the writer contains mostly numbers, but also more complicated structures to indicate what to do about addresses. My new formatter for Lisp programs has a main function (that users invoke) which can take several kinds of arguments. It can take a single file name (a string), a list of file names, or a "system" (a symbol designating an aggregate of files, actions, etc - something like a makefile). In the Unix/C world, all command line arguments are strings, and if any represent something else (such as a number), the program must do all of its own processing. Makes me sad to think of all the hours spent on such low-level tasks... Most code is not polymorphic. It doesn't usually make sense to divide strings or capitalize numbers. But in those cases where it is desirable, the right language makes polymorphism natural and easy to use, while low-level languages require the re-invention of tagged data types, symbols, storage reclamation, and all the other things builtin (and probably more efficiently) in languages like Lisp, Prolog, and Smalltalk. > -paul asente stan shebs