Newsgroups: comp.object,comp.lang.eiffel,comp.lang.c++,comp.lang.smalltalk
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!nntp.sei.cmu.edu!cis.ohio-state.edu!math.ohio-state.edu!howland.reston.ans.net!torn!watserv2.uwaterloo.ca!undergrad.math.uwaterloo.ca!clgonsal
From: clgonsal@undergrad.math.uwaterloo.ca (Carl Laurence Gonsalves)
Subject: Re: Why is one OO language more productive than another?
Message-ID: <DE7B7p.9w9@undergrad.math.uwaterloo.ca>
Sender: news@undergrad.math.uwaterloo.ca (news spool owner)
Nntp-Posting-Host: cayley.uwaterloo.ca
Organization: University of Waterloo
References: <40t027$7j9@hardcopy.ny.jpmorgan.com> <40vashINNgo8@bhars12c.bnr.co.uk> <9523600.18871@mulga.cs.mu.OZ.AU> <26jg07$031@zoe.pcix.com>
Date: Fri, 1 Sep 1995 00:40:36 GMT
Lines: 56
Xref: glinda.oz.cs.cmu.edu comp.object:37791 comp.lang.eiffel:10711 comp.lang.c++:147077 comp.lang.smalltalk:27891

>Sounds good, but there is a lot more to it than that.  Suppose you had
>been using smalltalk instead of C++, now what would happen if a message
>or operation had been performed on one of those 'mistyped' variables?
>It is possible, and very likely, that with many of them nothing would
>have happened because the way the variable was used was correct, so
>that the message being sent was defined in the receiving object and
>would have worked.  It is just that the declaration was wrong.  In
>other cases you get a 'doesNotUnderstand:' message the first time
>the message is sent, and that is just as easy and fast to fix as
>correcting a declaration.

Except that you only ever see the message if you happen to hit that piece
of code. With static type checking all of the type errors are found for you
at once. With dynamic type checking you have to rely on testing to find the
problem. The same applies to most error checking situations. The more
errors you can get to "show themselves" at compile time, the less time you
have to spend looking for them at runtime.

>Typing is of most value to the compiler.  If the compiler does not
>need typing then its value is greatly reduced.

I don't think so. Code where objects are typed is easier to understand,
because you can tell what the thing is. In the real world we not only come
up with names for objects and actions, but also for classes of objects. The
fact that human beings naturally "type" things is a pretty good indication
that there is something about our system of thought that requires, or at
least desires typing.

I have to be honest, the only languages I've used that were *really* loose
about types are Scheme, BASIC, and Rexx. In Scheme, everything's either an
atom or a list, and so lista are used to represent virtually anything. It
gets very difficult to figure out sometimes what this list you're holding
actually is. Very annoying.

In BASIC, which does have arrays, integers, and floats, I used to use
strings to represent almost anything. I would basically treat the string as
a stream of bytes, and I used to store bitmaps, and sounds samples in
strings. Very weird.

In Rexx there are strings and "stems" (associative arrays). I remember
writing a shortest path algorithm in Rexx. I remember thinking all the time
"God, I wish I had a typed language to use".

>The only case where typing catches significant errors during program
>development is where the program logic is wrong and the wrong message
>is being sent to an object.  I would contend that the number of
>situations where this occurs is a lot smaller.  I would say that the
>cost of using typing to catch these errors it simply too high.

What is this "high cost"? 

-- 
        Carl Laurence Gonsalves - clgonsal@undergrad.math.uwaterloo.ca
                   Computer Science, University of Waterloo
               http://www.undergrad.math.uwaterloo.ca/~clgonsal/
                     http://csclub.uwaterloo.ca/~clgonsal/
