🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #3533

Re: Run-time Type Errors in Smalltalk

#3533
From: David M Geary
Date: Tue, 16 Apr 1991 16:46
54 lines
2800 bytes
In article <387@smds.UUCP>, Brian Boutel writes:

In article <1917@optima.cs.arizona.edu>, gudeman@cs.arizona.edu (David
Gudeman) writes:
|> In article  <1991Apr15.065146.16680@tkou02.enet.dec.com> Norman
|> Diamond writes:
|> ]In article <4243.2805b94a@iccgcc.decnet.ab.com>
|> klimas@iccgcc.decnet.ab.com writes:
|> ]>	Some info that I picked up from a company doing a lot of big
|> ]>	project work with C++ (i.e. strong type checking language) was
|> ]>	that postmortems on their project revealed only 10% of their
|> ]>	errors were captured by strong type checking.
|> ]...
|> ]In any other field of engineering, a 10% increase in safety would
|> always
|> ]be applied.  To reject it would be grounds for lawsuits, at least.
|> 
|> How do you get a 10% increase in safety from the above?  If they
|> hadn't caught those errors by static typing they would have caught
|> them by testing -- the same way the found the other 90% of the
|> errors.

]The claim that testing catches all errors is laughable. Errors show up
]in production code every day. Testing, as we tell first year students,
]does not demonstrate the absence of errors, only their presence.

] So what can be said about all the errors in the quoted C++ project that
] where not caught by testing and are still in the production code?

] I'll tell you. They are not type errors.

  Not neccessarily:  

struct junk  { int  x;  float  f; };
struct other { int  y;  double d; };

main() 
{
  static struct junk  myJunk = {1, 1.1};
  struct junk  *p = &myJunk;

  printf("%d\n", ((struct other*)myJunk)->x);
}

  Looks like a type error that got by the compiler to me.  Note that statically
typed languages (such as C++) usually contain some mechanism (here, the cast)
so that the typing system enforced by the compiler may be circumvented.
Therefore, as shown above, type errors can still get by the compiler.

  In fact, in C++, considerable effort is expended (via manipulating the
inheritance tree, or casting derived classes to base classes, etc) to ensure 
that the compiler will accept a given expression as "type safe".  However,
the given expression may well violate the type system.  Errors such as this
are difficult to track down ...
Technical Details
Message-ID: <3856@ssc-bee.ssc-vax.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!batcomputer!cornell!uw-beaver!ssc-vax!dmg
References: <1917@optima.cs.arizona.edu> <1991Apr15.234559.16293@comp.vuw.ac.nz>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!batcomputer!cornell!uw-beaver!ssc-vax!dmg
From: dmg@ssc-vax (David M Geary)
Newsgroups: comp.lang.misc
Subject: Re: Run-time Type Errors in Smalltalk
Message-ID: <3856@ssc-bee.ssc-vax.UUCP>
Date: 16 Apr 91 16:46:16 GMT
References: <1917@optima.cs.arizona.edu> <1991Apr15.234559.16293@comp.vuw.ac.nz>
Sender: news@ssc-vax.UUCP
Reply-To: dmg@ssc-vax.UUCP (David M Geary)
Organization: Boeing Aerospace & Electronics
Lines: 54