Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!ut-sally!husc6!think!ames!amdcad!cae780!daniels From: daniels@cae780.TEK.COM (Scott Daniels) Newsgroups: comp.lang.smalltalk Subject: Re: declarations vs smalltalk Message-ID: <4207@cae780.TEK.COM> Date: Mon, 6-Jul-87 15:05:07 EDT Article-I.D.: cae780.4207 Posted: Mon Jul 6 15:05:07 1987 Date-Received: Wed, 8-Jul-87 04:41:52 EDT References: <245100009@orstcs> Reply-To: daniels@cae780.UUCP (Scott Daniels) Organization: Tektronix, Inc., Beaverton, OR. Lines: 32 In article <245100009@orstcs> budd@orstcs.cs.ORST.EDU writes: >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. C - user gives declarations, not checked at run time. >2. Pascal - declarations checked statically >3. Hidden code checks conformability of argument types with declarations > Why is this any more efficient than user written code to do the same task? >4. Types are part of the message pattern (Generics) > >option number 5? In response to your comment on (3): How about the value this provides to the reader of the code? Given the language guaranteed a certain type was provided, the code might read much more easily. This would mean treating the declaration as a kind of "ASSERT". As for a (5), how about: The type provides advice to the compiler to build code which works more efficiently if the given class of object is provided. A simple check and branched code, with slow compact code for the abnormal case, and fast code for the provided declaration. Thus this might be analogous to the "register" declaration in C (and you might also give compile- time warnings if messages that the declared class was unable to handle were sent to the objects so declared). FROM: Scott Daniels, Tektronix CAE 5302 Betsy Ross Drive, Santa Clara, CA 95054 UUCP: tektronix!teklds!cae780!daniels {ihnp4, decvax!decwrl}!amdcad!cae780!daniels {nsc, hplabs, resonex, qubix, leadsv}!cae780!daniels