🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #4649

Re: OBJ2 and Smalltalk

#4649
From: asente
Date: Wed, 04 Feb 1987 18:59
41 lines
2738 bytes
In article <4255@utah-cs.UUCP> shebs@utah-cs.UUCP (Stanley Shebs) writes:
>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

...following are many good examples of why you want polymorphism.

In case it wasn't clear from my original posting, it is not polymorphism
that I find questionable, it's unbounded polymorphism.  In each of the
examples in Stanley Shebs' article, you are chosing a type out of
a limited set that you know beforehand.  Even Simula allows that, and
it can be appropriately type-checked.  What I find of dubious usefulness
and even more dubious stylistic practice even if it were useful is
creating a data structure having no idea of what goes into it.  Can
you actually think of an example where you would want a queue that
allowed you to enqueue absolutely anything?  If you know what's going in,
it may be more convenient to program it with no element type checking
than to set up subtypes of the queue elements for the types you know
are going in, but is it really good style?

Of course, "style" is about the vaguest word you can use to describe
a program.  What I mean by style is the degree that the program can
be understood and modified by someone unfamiliar with it.  This of
course may well be the author, two years later.

One final point...if you REALLY need a queue with anything in it,
languages like CLU allow you to sidestep the type system by using
a predefined type that is the union of all types.  But you don't
have to sacrifice the advantages of compile-time type checking
for this one obscure instance.

	-paul asente
Technical Details
Message-ID: <278@figaro.STANFORD.EDU>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!mit-eddie!genrad!decvax!decwrl!labrea!figaro!asente
References: <4000001@nucsrl.UUCP> <3288@milano.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!rutgers!mit-eddie!genrad!decvax!decwrl!labrea!figaro!asente
From: asente@figaro.UUCP
Newsgroups: comp.lang.misc
Subject: Re: OBJ2 and Smalltalk
Message-ID: <278@figaro.STANFORD.EDU>
Date: Wed, 4-Feb-87 13:59:53 EST
Article-I.D.: figaro.278
Posted: Wed Feb  4 13:59:53 1987
Date-Received: Tue, 10-Feb-87 06:58:24 EST
References: <4000001@nucsrl.UUCP> <3288@milano.UUCP>
Reply-To: asente@figaro.UUCP (Paul Asente)
Organization: Stanford University CIS Apple Orchard
Lines: 41
Keywords: Useful queues?