🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.misc
Article #3377

Re: Run-time Type Errors in Smalltalk (was Re: blip (was...))

#3377
From: Mario Wolczko
Date: Thu, 04 Apr 1991 18:01
52 lines
3672 bytes
In article <887@puck.mrcu>, paj@mrcu (Paul Johnson) writes:
> Sorry, I am still not convinced.  I am currently programming in
> Eiffel, and changing my mind about a type is not something I often do.
> Also the type declarations carry information which affects the
> execution of the rest of the program.  Hence other parts of the
> program will need changing as well.  It seems to me that this will
> only result from a fairly major rewrite of some part of the code.

This could be a self-fulfilling statement, ie you don't change your
mind about types because you know it's going to be hard work to fix
the type declarations up, whereas in a declarationless language
sorting out the declarations doesn't arise.

> Does anyone have any facts relating to the assertion that run-time
> failures due to type errors are rare in Smalltalk development?

I'm not sure what this means in Smalltalk, much less how you measure
it.  You can't just count "doesNotUnderstands", because some of these
are not type errors (such as asking for the tail of an empty list).

As for statistics, do you want "how many Smalltalk programs have ever
given a run-time type error in their whole lifetime, after they were
declared to be `finished'?"  Most Smalltalk programs I have seen are
prototypes or research programs, and are rarely declared "finished",
so I guess this would be close to 100%.  However, if you ask this
question of any language, replacing "type error" with "error", then my
guess is that the answer is the same.  Very few "finished" programs
are bug-free, type-checked or not, so it's clear that type checking is
only addressing a small part of the problem.

Or perhaps you mean "how many runs of Smalltalk programs have resulted in
run-time type errors?".  This must be close to 0%.  Neither of these
figures means very much.  

Speaking from personal experience, I find that after I have written
some Smalltalk code (and I have written >10000 lines in the last 18
months) there are a few residual "type errors" which get caught in the
first few test runs.  The time taken to find and fix these is much
smaller than the time it would take me to declare all the variables in
such a way as to satisfy a type-checker (even if it were possible with
current type systems, which it isn't in many programs).

The real problems that take hours to find and fix are undetectable
using type-checking, such as writing "x+y" instead of "x-y".

Mario Wolczko

   ______      Dept. of Computer Science   Internet:      mario@cs.man.ac.uk
 /~      ~\    The University              uucp:      mcsun!ukc!man.cs!mario
(    __    )   Manchester M13 9PL          JANET:         mario@uk.ac.man.cs
 `-':  :`-'    U.K.                        Tel: +44-61-275 6146  (FAX: 6280)
____;  ;_____________the mushroom project___________________________________
Technical Details
Message-ID: <2367@m1.cs.man.ac.uk>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!mucs!cs.man.ac.uk!mario
References: <3523:Mar1803:21:0591@kramden.acf.nyu.edu> <22032@yunexus.YorkU.CA> <14160@life.ai.mit.edu> <1991Mar25.201620.5839@cua.cary.ibm.com> <879@puck.mrcu> <PX.91Apr1225918@hal.fct.unl.pt> <887@puck.mrcu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!think.com!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!mucs!cs.man.ac.uk!mario
From: mario@cs.man.ac.uk (Mario Wolczko)
Newsgroups: comp.lang.misc,comp.object
Subject: Re: Run-time Type Errors in Smalltalk (was Re: blip (was...))
Message-ID: <2367@m1.cs.man.ac.uk>
Date: 4 Apr 91 18:01:39 GMT
References: <3523:Mar1803:21:0591@kramden.acf.nyu.edu> <22032@yunexus.YorkU.CA> <14160@life.ai.mit.edu> <1991Mar25.201620.5839@cua.cary.ibm.com> <879@puck.mrcu> <PX.91Apr1225918@hal.fct.unl.pt> <887@puck.mrcu>
Sender: news@cs.man.ac.uk
Reply-To: mario@cs.man.ac.uk (Mario Wolczko)
Followup-To: comp.lang.misc
Organization: Department of Computer Science, University of Manchester
Lines: 52