Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!zephyr.ens.tek.com!tektronix!nosun!qiclab!m2xenix!puddle!p3.f18.n114.z1.fidonet.org!Chip.Richards From: Chip.Richards@p3.f18.n114.z1.fidonet.org (Chip Richards) Newsgroups: comp.lang.modula2 Subject: Re: Implementing Abstract Lists Message-ID: <224.26BF133D@puddle.fidonet.org> Date: 6 Aug 90 02:25:27 GMT Sender: ufgate@puddle.fidonet.org (newsout1.26) Organization: FidoNet node 1:114/18.3 - Iasd Eng Bbs, Phoenix Az Lines: 35 In a message dated 1 Aug 90, dgil@pa.reuter.COM (Dave Gillett) wrote: > So I was severely disappointed to discover that the "List" module presented > does not in fact deal with lists in the abstract, but with lists of things > of type "ItemType" which is imported from some other module. So in a > typical real-world program, if I have three types of things that I want > lists of, I need three (almost but not quite identical) copies of the List > module as presented. Umm, gee, Dave, maybe I'm missing the point, here, but isn't this where a variant record would come in real handy? As in TYPE ThingType = ( aThing, anotherThing, lastThing ) ; ItemType = RECORD CASE ThingType OF aThing: fields for a thing | anotherThing: fields for another thing | lastThing: fields for last thing END (* case *) END ; Maybe I just misunderstood your problem, but using the above definition, one copy of the "List" module would handle three widely different types of things. Chip -- uucp: uunet!m2xenix!puddle!114!18.3!Chip.Richards Internet: Chip.Richards@p3.f18.n114.z1.fidonet.org