Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!ucsd!hub.ucsb.edu!eiffel!kimr From: kimr@eiffel.UUCP (Kim Rochat) Newsgroups: comp.object Subject: Re: Do we really need types in OOPL's? Summary: Why Eiffel is typed Message-ID: <411@eiffel.UUCP> Date: 21 Sep 90 18:04:24 GMT References: <0yw10qr@Unify.Com> Organization: Interactive Software Engineering, Santa Barbara CA Lines: 34 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? The last comment is the reason Eiffel is typed. Because of typing, the compiler can verify that class interfaces (i.e., types) are properly used, and a type error cannot occur at run time. In contrast, dynamically typed languages get type errors at run time instead of compile time. Typing inhibits dynamic binding only in the sense that you are only allowed to send polymorphic messages to (families of) objects which are guaranteed to understand them, and you are not allowed to send messages to objects which aren't guaranteed to understand them. The combination of multiple inheritance, static typing, and dynamic binding works quite well in practice. Static typing also allows optimizations to be made which are difficult or impossible in a dynamically typed language, such as the removal of the code from an application for methods which the compiler can guarantee are never executed by the application. In Dr. Meyer's book, "Object-Oriented Software Construction", you will a find a complete explanation of "why Eiffel is a typed language". Kim Rochat Interactive Software Engineering responses to eiffel@eiffel.com