Path: utzoo!attcan!uunet!decwrl!sdd.hp.com!usc!snorkelwacker!bloom-beacon!eru!hagbard!sunic!kth.se!news From: d87-mra@dront.nada.kth.se (Magnus Ramstr|m) Newsgroups: comp.object Subject: Re: Do we really need types in OOPL's? Message-ID: <1990Sep25.135145.3460@kth.se> Date: 25 Sep 90 13:51:45 GMT References: <0yw10qr@Unify.Com> <411@eiffel.UUCP> <736@tetrauk.UUCP> Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 53 In the otherwise very well written article <736@tetrauk.UUCP> rick@tetrauk.UUCP (Rick Jones) writes: > >A fundamental confusion here is the distinction (or lack of it) between types >and classes. Classification is really all about taxonomy, and being able to >describe something by saying "this is like X except ...". This is a very good >method for defining a software module (i.e. a class), and the basis of code >re-use in OOPLs. > Even though I am sure that the poster as well as most of you are well aware of the mistake in this quote, I still want to point it out since it is a common mistake, and it might confuse newcomers to OO. Classification and inheritance is one basis of code reuse in OOPL, but not THE basis. The most important basis for code reuse in OOPL's is polymorphism, which allows for programming with interchangable parts. Now we return to the subject of this discussion: Do we really need types in OOPL's? or Do we really need early binding in OOPL's? Several postings have pointed out advantages with early binding, but noone has (yet in a posting that has reached this site) adressed the advantage of late binding mentioned in the original posting: In article <0yw10qr@Unify.Com>, dbrus.Unify.Com.brian@unify.uucp (Brian Meyerpeter ) writes: > I have a question that has been bugging me for a long time. > > Why does Eiffel try to be a typed language? > > In an ideally object-oriented language shouldn't you be able to assign > a class of any type to another class of any type as long as the > client that is assigning them knows their interface and does not > abuse it? > This can be achieved in a strongly typed OOPL by having one class as the ancestor of all other classes, letting your variables refer to that class and using virtual messages only. Therefore a strongly typed OOPL can be transformed into a weakly typed one, while the reverse is not true. When using a strongly typed OOPL the programmer has to compromise between type checking and polymorphism. I would say that we do not REALLY need types in OOPL's , but there are many situations where they are useful. Then of course it is very simple to create an OOPL using late binding only, while it is hard to create a strongly typed OOPL (I am really impressed by all the implementators of Simula). d87-mra@nada.kth.se (Magnus Ramstr|m). Student @ Dep. of Computer Science.