Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!midway!ux1.cso.uiuc.edu!render From: render@cs.uiuc.edu (Hal Render) Newsgroups: comp.object Subject: Re: Do we really need types in OOPL's? Message-ID: <1990Oct19.180646.8649@ux1.cso.uiuc.edu> Date: 19 Oct 90 18:06:46 GMT References: <1426@media01.UUCP> <1990Oct9.190813.23402@ux1.cso.uiuc.edu> <2444@runxtsa.runx.oz.au> Sender: news@ux1.cso.uiuc.edu (News) Organization: U. of Illinois, Dept. of Computer Science, Systems Research Group Lines: 35 In article <2444@runxtsa.runx.oz.au> timm@runxtsa.runx.oz.au (Tim Menzies) writes: [an article about how Smalltalk's lack of strong-typing hasn't been a detriment to his work] Assuming that any software you write is thoroughly tested, most type errors that would be caught at compilation can be caught during testing. I think that this is the reason that strong typing may not be absolutely necessary. However, any error that can be caught by the compiler is one less that a human has to catch, and so I personally like having type-checking as part of a programming language. In languages that don't have strongly-typed variables, I often do the checking "by-hand" anyway. For example, If I write a method 'foo: bar' in Smalltalk and expect bar to be an instance of SomeClass, then the first thing that I'll do in the method is send 'isKindOf: SomeClass' to bar and raise an error if it returns false. Although I would probably catch such an error during testing without this statement, checking the class explicitly means fewer potential error that I have to determine the cause of during runtime. Now, if I had never had a problem with sending a message to the wrong kind of object I would say that checking an object's class was not useful. But, my experience has shown me that such errors are not unknown particularly when working with closely related objects. Another potential benefit of strong typing is in allowing compilers to produce more efficient code. Although I haven't read much on the issue, I have heard that one of the reasons that Ralph Johnson's Typed Smalltalk compiler may turn out to be quite usefule is that the type checking may allow the compierl to optimize method look-up. Anything that can improve the speed of Smalltalk code will help it to gain wider acceptance among project managers which in turn would mean that more programmers could use Smalltalk instead of nastier, grundgier languages (pick one). This would be A Good Thing. hal.