Newsgroups: comp.lang.c++,comp.lang.smalltalk,comp.lang.eiffel,comp.lang.ada,comp.object,comp.software-eng
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!feed1.news.erols.com!news.ecn.uoknor.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: OO, C++, and something much better!
X-Nntp-Posting-Host: dev50
Message-ID: <E4Hx76.7tE@syd.csa.com.au>
Sender: news@syd.csa.com.au
Reply-To: donh@syd.csa.com.au
Organization: CSC Australia, Sydney
References: <32E774C4.534B@watson.ibm.com>
Date: Fri, 24 Jan 1997 04:45:05 GMT
Lines: 66
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:242580 comp.lang.smalltalk:49809 comp.lang.eiffel:17594 comp.lang.ada:56362 comp.object:60218 comp.software-eng:52896

Norman H. Cohen writes:

:Don Harrison wrote:
:>
:> Matthew Heaney writes:
:>
:....
:> :
:> :And as far as your example "proving" that Ada is not type-safe: that is
:> :incorrect.
:>
:> Correct, according to the Ada definition. As Norman Cohen put it,
:>
:> : It shows that Ada is not subtype-safe.
:>
:> That becomes "not type-safe" if you regard sub-types as distinct types.
:
:I'm reminded of the following riddle, which I've seen attributed to
:Abraham Lincoln:
:
:   Q: If you call a dog's tail a leg, how many legs does a dog have?
:   A: Four.  Calling the tail a leg does not make it one.

Nice quote. :)  If Abe Lincoln said it, it must be true! :)

:Calling a subtype a distinct type does not make it one.  Reread that
:post of mine that you quoted.  Its main point is that, according to the
:Ada definition, subtypes are NOT distinct types.  

I no longer have it but I did read it. What you suggest is true "according to 
the Ada definition". However, IMO, the definition is inadequate. 

:Distinct types are
:disjoint sets of values distinguished at compile time.  

Don't agree. I think they must simply be *different* sets of values. In the 
special case where the set of values is a subset of the values of another 
type, you have a sub-type (in the Ada sense). 

:Subtypes of a
:type are (possibly overlapping) sets of values in the same type,
:distinguished by whether or not they obey certain constraints that can,
:in general, only be checked at run time.

Yes ... "according to the Ada definition".


The real issue, as far as I'm concerned, is that type safety (not surprisingly)
depends on the definition a type. A language such as Eiffel might be regarded
as type-unsafe purely because it regards sub-types as distinct types. These 
types - and their attendant runtime constraint violations - are materially
no different from equivalent sub-types in Ada - which also cause runtime
constraint violations.

It's absolutely meaningless to declare one language type-safe and another 
unsafe without reference to the definition of type underlying the claim.

Is it possible to write a system-invalid Ada program? Definitely, ... as you
can with Eiffel.


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


