Path: utzoo!attcan!uunet!husc6!bloom-beacon!gatech!unmvax!deimos.cis.ksu.edu!uxc!iuvax!watmath!watmsg!gjditchfield From: gjditchfield@watmsg.waterloo.edu (Glen Ditchfield) Newsgroups: comp.lang.c++,comp.lang.eiffel,comp.lang.smalltalk Subject: Re: Use of inheritance for classification? Summary: Remember Alphard? Message-ID: <26381@watmath.waterloo.edu> Date: 19 May 89 15:47:10 GMT References: <30582@apple.Apple.COM> <6365@brunix.UUCP> <6685@brunix.UUCP> <24537@agate.BERKELEY.EDU> <6743@brunix.UUCP> Sender: daemon@watmath.waterloo.edu Reply-To: gjditchfield@watmsg.waterloo.edu (Glen Ditchfield) Organization: U. of Waterloo, Ontario Lines: 25 Xref: utzoo comp.lang.c++:3373 comp.lang.eiffel:200 comp.lang.smalltalk:1088 In article <6743@brunix.UUCP> bpe@zaphod.UUCP (Page Elmore) writes: >I agree with Bob Heiney's comments -- we are confusing matters by mixing >subsets with subtypes via inheritance. I would say that we need a mechanism >for is-a inheritance which preserves substitutability, and one for subset >which allows classifiction. I would put it this way: we should have an inheritance mechanism for code reuse, and we should have a specification mechanism (perhaps like Russell signatures) for substitution. The last means that, if a function wants to add two parameters, it should specify that the parameters have a '+' operation. It should not specify that they must inherit from Number, and thereby risk excluding strings. Alphard did this mostly right, back in the mid 70's. Alphard let you say things like function f( p1, p2: ?T< plus(T,T) returns T > ) which means that f has two parameters that can be of any type, as long as that type has a "plus" function. (Read ?T as "forall T".) Alphard also promised data abstraction, inheritance, generic types, and an elegant approach to iterators that is quite unlike the CLU-style coroutine approach. It was a sad day when the Alphard team decided not to produce a compiler... Glen Ditchfield gjditchfield@violet.uwaterloo.ca Office: DC 2517 Dept. of Computer Science, U of Waterloo, Waterloo, Ontario, Canada, N2L 3G1 waddles like-a Duck & quacks like-a Duck => is-a Duck