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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b87849933931bc93 X-Google-Attributes: gid103376,public X-Google-Thread: fac41,b87849933931bc93 X-Google-Attributes: gidfac41,public X-Google-Thread: 109fba,b87849933931bc93 X-Google-Attributes: gid109fba,public X-Google-Thread: 114809,b87849933931bc93 X-Google-Attributes: gid114809,public X-Google-Thread: 1111a3,5ee869da42505971 X-Google-Attributes: gid1111a3,public X-Google-Thread: 1108a1,b87849933931bc93 X-Google-Attributes: gid1108a1,public From: shang@corp.mot.com (David L. Shang) Subject: Re: Combining dynamic and static typing Date: 1997/01/29 Message-ID: <1997Jan29.153455.14196@schbbs.mot.com>#1/1 X-Deja-AN: 212997718 sender: news@schbbs.mot.com (SCHBBS News Account) references: organization: MOTOROLA reply-to: shang@corp.mot.com newsgroups: comp.lang.eiffel,comp.lang.ada,comp.lang.c++,comp.lang.smalltalk,comp.lang.objective-c,comp.object Date: 1997-01-29T00:00:00+00:00 List-Id: In article rmartin@oma.com (Robert C. Martin) writes: > > C++ uses static typing for member function dispatch, but uses dynamic > typing (of a sort) for template dispatch. I am surprised to hear that C++ template uses dynamic typing (even it is a sort of). What is dynamic typing after all? We need a definition here because people use this term for different concepts, and there is always a confusion without an explicit definition. Anyway, C++ template has nothing to do with "dynamic". > I say (of a sort) because > the type are still checked at compile time, even in templates. However, > templates can call member functions without the need to specify the > *type* in which those member functions are declared. Indeed, there > need be no supertype contains the common declaration. Thus, in that > regard, template invocation is similar to ST dynamic types. > The type check for a class parameter in a C++ template is done at the time of the template is expanded. This is still at compile time, not at run-time. If we have to compare C++ templates with SmallTalk classes, yes, they have one common property: late-type-error-detection, that is, the error is detected at the time they are used, but not at the time they are designed and developed. However, SmallTalk classes are released to clients in executable form, so the use time is run-time. But C++ templates is presented to clients in source form, and the use time is still compile-time. David Shang