Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!sps!wwb From: wwb@sps.com (Bud Bach) Newsgroups: comp.object Subject: Re: Do we really need types in OOPL's? Summary: types jog your memory and trap more errors at compile time... Message-ID: <275@sps.com> Date: 21 Sep 90 14:46:14 GMT References: <0yw10qr@Unify.Com> Organization: SPS - Indialantic, FL Lines: 32 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? Shouldn't dynamic binding > allow for any type to be assigned to anytype? It might be a nice feature > to restrict assignments (dynamic binding) in some cases but in others > I don't think so. > > 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? > ... There's the rub. In large systems it is difficult to remember or "know" the interface. If an object is typed then, the client has some confidence that the object will plug into the system and respond to the appropriate messages. Also don't forget that objects may be passed as parameters or returned as functions also. As an implemeter of a class, it is useful to restrict the kind of objects that may be passed to some useful subset. For example, suppose you wish to export a method for adding the contents of a container to another container. What if the client sends an integer instead of a container? Granted, you might catch this at runtime, but why not catch it sooner? -- Bud Bach Voice: 407 984-3370 Software Productivity Solutions, Inc. FAX: 407 728-3957 122 4th Avenue email: wwb@sps.com Indialantic, FL 32903 or: ...!uunet!sps!wwb