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: 109fba,b87849933931bc93 X-Google-Attributes: gid109fba,public X-Google-Thread: 103376,b87849933931bc93 X-Google-Attributes: gid103376,public X-Google-Thread: 114809,b87849933931bc93 X-Google-Attributes: gid114809,public X-Google-Thread: 1108a1,b87849933931bc93 X-Google-Attributes: gid1108a1,public From: knight@acm.org (Alan Knight) Subject: Re: OO, C++, and something much better! Date: 1997/01/28 Message-ID: <5clodh$3io$1@newsfeed.ftn.net>#1/1 X-Deja-AN: 212915876 references: <32DF458F.4D5C@concentric.net> <32DF94DC.6FF8@watson.ibm.com> <32DFD972.37E4@concentric.net> <5bphq4$5js@mulga.cs.mu.OZ.AU> <32E05FAF.47BA@concentric.net> <5buodl$bci@boursy.news.erols.com> <32E2FEC7.2F7B@concentric.net> <5bvncj$gqg$1@A-abe.resnet.ucsb.edu> <32E47B4B.56D9@concentric.net> <5c4fr0$27j@mulga.cs.mu.OZ.AU> <32E67751.4AFC@parcplace.com> <5caqo5$k5l@mulga.cs.mu.OZ.AU> organization: The Object People newsgroups: comp.lang.c++,comp.lang.smalltalk,comp.lang.eiffel,comp.lang.ada,comp.object Date: 1997-01-28T00:00:00+00:00 List-Id: In article <5caqo5$k5l@mulga.cs.mu.OZ.AU>, fjh@mundook.cs.mu.OZ.AU (Fergus Henderson) wrote: >Eric Clayberg writes: > >>Fergus Henderson wrote: >>> My experience is that errors caught by type checking constitute a LOT >>> more than 2% of errors. >>> For a period of time I carefully recorded the cause of every error that >>> I found while writing a Mercury program. Of the 155 errors that I >>> recorded, 73 were error caught by the type checker. .. >Some (14) of those 70 errors were related to the syntax, but most of >them were errors such as "wrong number of arguments", "wrong procedure >name", and so forth, that could occur in just about any language. Note >that the number 70 does *not* include errors in the type declarations >themselves; there were an additional 13 of those. I know I'll regret jumping into this. On the one hand we have people talking about the problem with dynamic type errors being that they are not found until "run-time", apparently with the assumption that run-time happens with end-users, and that testing is totally inadequate as a means of catching them. That appears quite inconsistent with this definition of type errors, since they are almost all things that would be caught the first time the code was *EVER* run. In fact, both examples given (wrong # of arguments, wrong procedure name) would probably be caught at compile-time in Smalltalk, even without any static type checking. In fact, depending on your Smalltalk IDE, it might even offer a list of valid alternatives based on its attempt to correct your spelling. In fact, from a casual glance, I see only one class of errors that I would classify as a type error in Smalltalk. > - argument has wrong type: 7 out of 155 that's 4.5%, somewhat above the 2% quoted by some of the other posters, but probably within the limits of precision. Of course, many of those errors also get caught the first time the code is run too. Here's how I'd account for the others listed - errors in type declarations: 13 No type declarations - syntax related: 14 Comes from this odd mercury syntax you mentioned. Almost any language, no matter how dynamic, will catch syntax errors at compile time. - wrong procedure name: 11 Many cases would be caught at compile time (and spelling-corrected), otherwise caught the very first time the method is invoked. - wrong constant name: 4 Caught at compile time if it's really a constant, but in Smalltalk, constants are often treated as class methods, in which case it would be treated as a wrong procedure name. - wrong variable name: 4 Caught at compile time. - wrong number of arguments: 21 Very hard to do in Smalltalk. Counts as wrong procedure name. - incorrect argument order: 5 Also very hard to do in Smalltalk and counts as either wrong procedure name or argument with wrong type. -- Alan Knight | The Object People knight@acm.org | Your Smalltalk Experts 613.225.8812(v) 613.225.5943(f) | http://www.objectpeople.com "That does not mean we should give up reading nineteenth-century novels, we should read them avidly and often. What we must do is give up writing them" - Jeanette Winterson