From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fac41,b87849933931bc93 X-Google-Attributes: gidfac41,public X-Google-Thread: 1108a1,b87849933931bc93 X-Google-Attributes: gid1108a1,public X-Google-Thread: 103376,b87849933931bc93 X-Google-Attributes: gid103376,public X-Google-Thread: 114809,b87849933931bc93 X-Google-Attributes: gid114809,public From: bobduff@world.std.com (Robert A Duff) Subject: Re: Static vs. Dynamic typing again (was Re: OO, C++, and something much better!) Date: 1997/01/25 Message-ID: #1/1 X-Deja-AN: 212197795 references: <32E7E08A.3079@parcplace.com> <32E8BCE3.3029@calfp.com> <01bc0a1e$faed8ce0$c318b993@jarvisb> organization: The World Public Access UNIX, Brookline, MA newsgroups: comp.lang.smalltalk,comp.lang.eiffel,comp.lang.ada,comp.object Date: 1997-01-25T00:00:00+00:00 List-Id: In article <01bc0a1e$faed8ce0$c318b993@jarvisb>, Bob Jarvis wrote: >As were many of us ("raised" on statically-typed languages). I guess that >after a while you just shrug your shoulders and say, "Oh, nuts. If the dang >object responds properly to the messages I send it, what do *I* care what >its actual type or class is?". Fine, but you want to be able to know that "the dang object responds properly to the messages I send it" by doing a purely static analysis of the program. In fact, this is exactly what many people call "type" -- the concept of type, in this sense, embodies what messages the objects of that type respond to. >Perhaps the difference between statically and dynamically typed languages >is similar. I think it's a bit misleading to say that Smalltalk is dynamically typed versus Ada/C++/etc being statically typed. I mean, Smalltalk does not check the type of an object when passing it as a parameter. Not even dynamically. There's no way to even say what the type is supposed to be. Smalltalk doesn't check on assignment, either. Not statically, and not dynamically. The *only* thing Smalltalk checks is the *target* of the message. In other words, Smalltalk has less type checking -- it's not just a matter of moving type checking from compile time to run time, for the added flexibility. It's a matter of eliminating certain type checks entirely. This makes a big difference: when I was writing Smalltalk code, there would sometimes be nasty bugs, where a message parameter called aString was passed something other than a String, and then this is saved in some data structure, and passed around a bit more, until some time later, somebody trips over the bogus object by sending it a message that only Strings understand. - Bob