Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!shadooby!samsung!cs.utexas.edu!rice!uw-beaver!uw-june!ewan From: ewan@cs.washington.edu (Ewan Tempero) Newsgroups: comp.object Subject: Re: Understanding the Object-Oriented Life-Cycle Message-ID: <9828@june.cs.washington.edu> Date: 16 Nov 89 20:37:09 GMT References: <5026@internal.Apple.COM> <315@shrike.AUSTIN.LOCKHEED.COM> Reply-To: ewan@june.cs.washington.edu.cs.washington.edu (Ewan Tempero) Organization: University of Washington, Computer Science, Seattle Lines: 23 In article <315@shrike.AUSTIN.LOCKHEED.COM> aihaug@AUSTIN.LOCKHEED.COM (Daniel A Haug) writes: >By far (IMHO), the largest advantage to this is in code extensibility, >or reusability. It is so incredibly useful to define an algorithm >that doesn't care about the types on which it operates. For example, >I need only implement a priority queue ADT once. The algorithm is the >same, but the types can be whatever. As result, I only need to write >one QUEUE and DEQUE procedure that don't depend on any typing. Then, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >every object that is passed into the queue would need to support >some sort of comparison method that QUEUE would call to determine >proper placement. But QUEUE and DEQUE aren't operations on _elements in the priority queue_! They are operations on objects of type "priority queue". So there is nothing "typeless" about them at all, you have just been using the wrong type. Many people seem to have this misconception which I think may be due to Pascal including the type of the element as part of the type of the array. There is a (OO) programming language called Emerald whose type system will allow you to do what you require. See "Distribution and Abstract Types in Emerald" by Black, Hutchinson, Jul, Levy, and Carter. Trans. Software Engineering, Dec 1986. --ewan