Newsgroups: comp.object,comp.lang.c++,comp.lang.ada,comp.lang.smalltalk,comp.lang.eiffel
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!cam-news-feed3.bbnplanet.com!cam-news-hub1.bbnplanet.com!news.bbnplanet.com!cpk-news-hub1.bbnplanet.com!EU.net!uunet!in1.uu.net!uucp3.uu.net!alexandria.organon.com!alexandria!jsa
From: jsa@alexandria (Jon S Anthony)
Subject: Re: OO, C++, and something much better!
In-Reply-To: Eric Clayberg's message of Thu, 30 Jan 1997 18:58:38 -0500
Message-ID: <JSA.97Jan31141325@alexandria>
Sender: news@organon.com (news)
Organization: Organon Motives, Inc.
References: <JSA.97Jan16141937@alexandria> <5buodl$bci@boursy.news.erols.com>
	<32E2FEC7.2F7B@concentric.net> <5bvncj$gqg$1@A-abe.resnet.ucsb.edu>
	<32E47B4B.56D9@concentric.net> <6PI998tV3RB@herold.franken.de>
	<32E68D40.65EC@parcplace.com> <JSA.97Jan24191048@alexandria>
	<32E999AE.2F68@parcplace.com> <32ED02EE.22E2@netright.com>
	<32ED2448.685A@parcplace.com> <32EE20A3.755D@netright.com>
	<32EE3899.1B49@parcplace.com> <32EE86CC.6258@netright.com>
	<32EEE219.3C03@parcplace.com> <32EF9457.7E2C@netright.com>
	<32F135AE.5700@parcplace.com>
Date: Fri, 31 Jan 1997 19:13:25 GMT
Lines: 93
Xref: glinda.oz.cs.cmu.edu comp.object:60662 comp.lang.c++:244660 comp.lang.ada:56958 comp.lang.smalltalk:50634 comp.lang.eiffel:18060

In article <32F135AE.5700@parcplace.com> Eric Clayberg <clayberg@parcplace.com> writes:

Eric,

These examples are not very interesting let alone convincing wrt
"error rates" being lower "overall" in dynamically checked languages
than statically checked ones.


> OK, that's a good one. Array out-of-bounds errors would occur far less
> frequently in Smalltalk than in other languages because:
                                  ^^^^^^^^^^^^^^^????

Sure - those that do none of this.  But many statically checked ones do.


> 1) Arrays are used fairly infrequently to begin with. Smalltalk provides
> a large number of specialized collections (Arrays, OrderredCollections,
> Bags, Sets, Dictionaries, SortedCollections, etc.) which would be used
> rather than a simple array. Many of these collection types don't even
> support access via index.

This is not an ST "feature" it is an "ST _LIBRARY_" feature.  OK, you
say that you can't really differentiate the two (or should not).
Shrug.  These kind of libraries are widely available for Ada and Eiffel.
Eiffel in particular has a _very_ rich and "standard" class library
for this sort of thing.  So, I don't see how ST (in particular) or
dyanamically typed languages (in general) has any advantage in this
respect.


> 2) Collection in Smalltalk are rarely accessed or traversed by index.

How is this different from #1?  Seems to be the same thing.  This
"iterator" stuff is standard/common practice and independent of
language used.  Details of _how_ they are _implemented_ vary, of
course, but that is not really relevant here.


> Quite a lot simpler and no chance of screwing up the indexes. I should

In many contexts, yes.  And it is language independent.


> aren't an issue. The closest parallel would be the special Smalltalk
> object nil. Smalltalk certainly does support the idea of uninitialized
> variables which initially all point to the object nil. nil is an object
> just like any other and supports a well defined set of messages.

I don't see how this is unique to ST in particular or dynamically
checked languages in general.  Certainly, the analogue is true in Ada.


> not understood" error. There are two common patterns used in Smalltalk
> that usually prevent unintended access to uninitialized variables. Most
> objects run their own initialize method when they are instantiated (this
> is sort of like a constructor operation in C++). Quite often, however,
> certain variable will be infrequently accessed or hold large complicated
> objects where it makes sense to defer the initialization until later. In
> such cases, the "lazy initialization" patter is used. Rather than write
> the accessor method to simply return the instance variable like this:

Both of these are widely used elsewhere.  For example, they are both
pretty standard idioms in Ada (from what I've seen).


> user selected Yes, No or Cancel. Thus nil is a commonly expected value
> in many situations and does not normally constitute an error.

Again, this is pretty typical elsewhere.


> > Do you feel any of these are inherently less likely in a
> > dynamically-typed language?  if so, why?
> 
> In the case of array access in Smalltalk, then yes. In the case of null

Well, I don't see how.  Looks like a wash to me.

> pointer usage (assuming that nil would be the closest approximation in
> Smalltalk), it's probably a wash.

Agreed.


/Jon
-- 
Jon Anthony
Organon Motives, Inc.
Belmont, MA 02178
617.484.3383
jsa@organon.com

