Newsgroups: comp.lang.smalltalk,comp.lang.eiffel,comp.lang.ada,comp.object
Path: cantaloupe.srv.cs.cmu.edu!bb3.andrew.cmu.edu!newsfeed.pitt.edu!portc02.blue.aol.com!howland.erols.net!spool.mu.edu!munnari.OZ.AU!news.mel.connect.com.au!news.syd.connect.com.au!syd.csa.com.au!news
From: donh@syd.csa.com.au (Don Harrison)
Subject: Re: Static vs. Dynamic typing again (was Re: OO, C++, and something much better!)
X-Nntp-Posting-Host: dev50
Message-ID: <E4v3GC.5r5@syd.csa.com.au>
Sender: news@syd.csa.com.au
Reply-To: donh@syd.csa.com.au
Organization: CSC Australia, Sydney
References: <E4L15n.GnC@world.std.com>
Date: Fri, 31 Jan 1997 07:28:59 GMT
Lines: 36
Xref: glinda.oz.cs.cmu.edu comp.lang.smalltalk:50573 comp.lang.eiffel:18036 comp.lang.ada:56925 comp.object:60631

Bob Duff writes:

:I think it's a bit misleading to say that Smalltalk is dynamically typed
:versus Ada/C++/etc being statically typed.  I mean, Smalltalk does not
:check the type of an object when passing it as a parameter.  Not even
:dynamically.  There's no way to even say what the type is supposed to
:be.  Smalltalk doesn't check on assignment, either.  Not statically, and
:not dynamically.  The *only* thing Smalltalk checks is the *target* of
:the message.  In other words, Smalltalk has less type checking -- it's
:not just a matter of moving type checking from compile time to run time,
:for the added flexibility.  It's a matter of eliminating certain type
:checks entirely.

Good point.

:This makes a big difference: when I was writing Smalltalk code, there
:would sometimes be nasty bugs, where a message parameter called aString
:was passed something other than a String, and then this is saved in some
:data structure, and passed around a bit more, until some time later,
:somebody trips over the bogus object by sending it a message that only
:Strings understand.

This is an important point, IMO. It's harder, IME, to identify the cause of
errors when their detection is far away (in the call stack) from their source.
This is because the symptoms are less readily correlated with the cause.
The closer to the source an error is detected, the better, IMO. This is also
where assertions ala Eiffel come in handy. You are able to exercise even
greater control over the quality of input parameters than strong typing alone
permits.


Don.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Don Harrison             donh@syd.csa.com.au


