🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #3165

CHALLENGE: heterogeneous collections

#3165
From: Joseph Pallas
Date: Mon, 25 Mar 1991 17:56
33 lines
2315 bytes
In <1991Mar22.210725.29448@neon.Stanford.EDU>
hoelzle@neon.Stanford.EDU (Urs Hoelzle) writes:

>But you aren't convinced and I've heard this argument often enough,
>so let me give an example.  Please show me how you would use the many
>features of Ada to write this in Ada (or any other statically-typed
>language):

>[example of heterogeneous list of "unrelated" objects deleted]

>To avoid misunderstandings, please note that the above example *is*
>type-safe in an abstract sense: no 'message not understood' error can
>occur because all elements of listC understand both 'foo' (which may
>be sent by someProc) and 'display'.  However, I claim that this piece
>of code won't type-check in Ada, C++, Eiffel, ...

Sooner or later, opponents of static typing bring out the
heterogeneous collection.  There's no question that it isn't possible
with most traditional language type-systems to express the type of the
list in Urs's example.  Type systems that can express union types
(such as, "an A or a B") or purely extensional types (such as,
"anything that understands 'foo'") [is that the right name, type
theory mavens?]  are not common (but not unknown, either---I think
Ralph Johnson's Typed Smalltalk can do this).

The problem is, no one has ever come up with a convincing reason why I
should want my type system to handle the heterogeneous collection.
This is because no one has come up with a convincing reason why I
should want to write programs that contain heterogeneous collections.
Needing collections of otherwise-unrelated objects generally signals a
flaw in the design, not a failing of the type system.

joe
Technical Details
Message-ID: <pallas.669923769@red-dwarf>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!sun-barr!newstop!exodus!red-dwarf!pallas
References: <22032@yunexus.YorkU.CA> <11820:Mar1923:59:3591@kramden.acf.nyu.edu> <19MAR91.22493670@uc780.umd.edu> <18271:Mar2013:19:1091@kramden.acf.nyu.edu> <1991Mar20.214231.3411@neon.Stanford.EDU> <jls.669591628@rutabaga> <1991Mar22.210725.29448@neon.Stanford.EDU>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!cs.utexas.edu!sun-barr!newstop!exodus!red-dwarf!pallas
From: pallas@eng.sun.com (Joseph Pallas)
Newsgroups: comp.lang.misc,comp.object
Subject: CHALLENGE: heterogeneous collections
Message-ID: <pallas.669923769@red-dwarf>
Date: 25 Mar 91 17:56:09 GMT
References: <22032@yunexus.YorkU.CA> <11820:Mar1923:59:3591@kramden.acf.nyu.edu> <19MAR91.22493670@uc780.umd.edu> <18271:Mar2013:19:1091@kramden.acf.nyu.edu> <1991Mar20.214231.3411@neon.Stanford.EDU> <jls.669591628@rutabaga> <1991Mar22.210725.29448@neon.Stanford.EDU>
Sender: news@exodus.Eng.Sun.COM
Followup-To: comp.lang.misc
Lines: 33