Path: utzoo!attcan!uunet!know!samsung!cs.utexas.edu!milano!cadillac!vaughan@mcc.com From: vaughan@mcc.com (Paul Vaughan) Newsgroups: comp.lang.c++ Subject: Re: libraries, compilers, class info, exceptions Message-ID: <11501@cadillac.CAD.MCC.COM> Date: 25 Sep 90 14:32:44 GMT References: <995@halley.UUCP> Sender: news@cadillac.CAD.MCC.COM Reply-To: vaughan@mcc.com (Paul Vaughan) Organization: MCC VLSI CAD Program Lines: 39 In-reply-to: cline@cheetah.ece.clarkson.edu (Marshall Cline) From: cline@cheetah.ece.clarkson.edu (Marshall Cline) Runtime (weak) typing is wonderful if you want a toy language that will solve toy problems. Strong typing is nearly essential for programming in the large. Smalltalk provides runtime typing but does NOT provide any compile time typing. C++ is exactly the opposite, which is the real tragedy of translating Smalltalk-like libraries into C++. Ie: forget the speed hit. Forget the 2x to 3x more new/delete calls caused by the Smalltalk model. Forget the 2x more pointer dereferences, and just think about discarding the only ONLY **ONLY** type checking the language *gives* you. The Smalltalk library was designed for Smalltalk, but not for C++. We use elements of NIHCL (actually extracted from the old OOPS) rather productively in conjunction with the compile time type checking. The OOPS based stuff supports interactive objects that must be manipulated by the user, both with user written code loaded at runtime and with more direct mechanisms. We don't tend to use OOPS based container objects per se; we use libg++ style lists and queues and other things. We do typecasts from time to time, mostly of the form Base* foo; if(foo.isA(class_MyBase)) { MyBase* myfoo = (MyBase*) foo; . . . } as a way to keep the program modular, but only at an interactive level--that is, we don't do dynamic type checking and casting in code that really needs to run fast. So, I don't look at it as throwing away the only type checking in the language. It merely augments the type checking capability. You might question the integrity of the dynamic type checking, since it's not built in to the compiler, but I've certainly found more bugs in g++ than I have in this code. The upshot is, you can use Smalltalk-like concepts (actually, I usually think more about CLOS) productively in conjunction with C++. Paul Vaughan, MCC CAD Program | ARPA: vaughan@mcc.com | Phone: [512] 338-3639 Box 200195, Austin, TX 78720 | UUCP: ...!cs.utexas.edu!milano!cadillac!vaughan