Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!gatech!hubcap!ncrcae!ncr-sd!hp-sdd!hplabs!hp-pcd!orstcs!budd From: budd@orstcs.cs.ORST.EDU Newsgroups: comp.lang.smalltalk Subject: declarations vs smalltalk Message-ID: <245100009@orstcs> Date: Mon, 29-Jun-87 13:50:00 EDT Article-I.D.: orstcs.245100009 Posted: Mon Jun 29 13:50:00 1987 Date-Received: Wed, 1-Jul-87 06:48:06 EDT Lines: 39 Nf-ID: #N:orstcs:245100009:000:1999 Nf-From: orstcs.cs.ORST.EDU!budd Jun 29 10:50:00 1987 I may be showing my vast ignorance again, but somehow I just don't see how adding type declarations to Smalltalk helps anything. It would seem as if one of the following cases must apply 1. The C philosophy - the user can give declarations, but these are not checked at run time. You pass something that doesn't match the declaration, your program will crash and burn. Not very nice. 2. The Pascal philososphy - declarations are all checked statically at some point long before run time. Either requires declarations everywhere (too restrictive and limits polymorphism) or requires extensive data flow analysis (complicated). 3. Hidden code is created to check the conformability of argument types with declarations prior to method execution. Why is this any more efficient than user written code to do the same task? Allowing the user to do it would seem to be more flexible. And what happes when the declarations are violated? Does the user have any recourse? 4. Types are considered as part of the message pattern for the purposes of method lookup. (This is an extension of object message lookup, where the types of arguments other than the first may also be important). This would seem to be the most general solution, since the only overhead involved is that of method lookup, not argument checking, and tricks such as caching can be used to speed up message lookup. Never the less, the Smalltalk notion of class is not the most useful concept of type that could be envisioned, and again this limits polymorphism. In short, there seems to be an implicit conflict between strong typing, or typing of any sort, and polymorphism. Strengthing one limits the other. Smalltalk has come down strongly on the side of polymorphism, and even I (Smalltalk heretic than I am) have a hard time imagining anything similar to Smalltalk that changes this. I am looking forward to hearing how I am all wrong, and how option number 5 makes all problems go away. --tim budd (budd@oregon-state)