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: 10a146,a03ae7f4e53958e1 X-Google-Attributes: gid10a146,public X-Google-Thread: fac41,a03ae7f4e53958e1 X-Google-Attributes: gidfac41,public X-Google-Thread: 1014db,a03ae7f4e53958e1 X-Google-Attributes: gid1014db,public X-Google-Thread: 109fba,a03ae7f4e53958e1 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,8775b19e3c68a5dc X-Google-Attributes: gid103376,public X-Google-Thread: 114809,a03ae7f4e53958e1 X-Google-Attributes: gid114809,public X-Google-Thread: 1094ba,a03ae7f4e53958e1 X-Google-Attributes: gid1094ba,public X-Google-Thread: fa0ae,a03ae7f4e53958e1 X-Google-Attributes: gidfa0ae,public From: bill@cafe.net (Kaz Kylheku) Subject: Re: Which language pays most? Smalltalk, not C++ nor Java. Date: 1997/12/30 Message-ID: <68btos$g7d$1@brie.direct.ca>#1/1 X-Deja-AN: 311449690 References: <199712121931.LAA25389@sirius.infonex.com> <34A50CAA.54AA@netup.cl> <685mee$5d4$1@sparcserver.lrz-muenchen.de> <34A812F9.C169A703@its.cl> Organization: Internet Direct Reply-To: kaz@cafe.net Newsgroups: comp.lang.fortran,comp.lang.c,comp.lang.c++,comp.lang.eiffel,comp.lang.java.programmer,comp.lang.smalltalk,comp.lang.perl.misc,comp.lang.ada,comp.edu Date: 1997-12-30T00:00:00+00:00 List-Id: In article <34A812F9.C169A703@its.cl>, Guillermo Schwarz wrote: >I'm sorry to hurt your feelings about C++. But it turns out that C++ is a >very poorlanguage. You can't know how many bits does an int have. Or if long >is actually bigger >than int. You can't ask an structure how many fields does it have. You can't Why would this be useful? >tell an >structure to write itself into a file. You can't code an algorithm that works Why not? Have you never heard of object store databases? >with any >kind of numbers: int, double, big int, etc. Nonsense. You obviously haven't heard of C++ features such as templates, and operator and function overloading. >In C++ there is no way to handle overflow of integers. An overflow is a serious programming error. The way you handle it is by not making the error in the first place. In C and C++, integer overflow invokes undefined behavior---an implementation isn't required to handle overflow, but may. You can detect overflows with assertions. I could lecture you how, but it would probably be a waste of time. You first need to learn the basics, like what a language standard is and how it differs from a compiler manual. >Ask in runtime how many classes do you have in your image. I can't imagine what possible benefit it could have, but I will concede that ``it's neat''. >Or try to figure out which classes descend from which. If you don't know which classes descend from which, you probably have a mess of a design. C++ is a _statically_ typed language; this gives it a performance advantage and added safety (though the type safety of C++ does arguably leave something to be desired.) Who writes high-performance applications in Smalltalk? >Try to make a single general program. What's that? I'm conjuring images of something that plays chess and routes IP packets at the same time. >Try to create a Set of objects in C++. >Try to create a Bag of objects in C++. >Try to create a SortedCollection of objects in C++. I'm not thorougly versed with the standard template library, but I believe that it has enough clout for this sort of thing. If not, you can implement your own classes. >Convert one collection into another. (SortedCollection as Bag or whatever). >Put a Set inside another Set. >Try to create a Dictionary of pairs of objects in C++ using hashing to index >the keys. >Then put a Dictionary and a Set inside a Dictionary with the Dictionary as >the key. >If you can do a single thing of what I wrote here you are a good C++ >programmer. I've created dictionaries having arbitrary element and key types (including self referential types) in the *C* programming language. In fact, I did them in my very first C programming project as an undergraduate freshman, in which I had to implement an interpreter for a small PostScript like language. In that language, it was possible to create dictionaries that contain keyword and value pairs, where the values can be of dictionary type. >All this can be done in 10 minutes in Smalltalk (if lazy). Yeah, and that's about how long it will take the executable to process ten dictionary items.