comp.lang.ada
 help / color / mirror / Atom feed
From: "Xenos" <dont.spam.me@spamhate.com>
Subject: Re: access & address
Date: Thu, 14 Oct 2004 15:37:26 -0400
Date: 2004-10-14T15:37:26-04:00	[thread overview]
Message-ID: <ckmkhq$i0k1@cui1.lmms.lmco.com> (raw)
In-Reply-To: 2t7jm8F1sp752U1@uni-berlin.de


"Marc A. Criley" <mcNOSPAM@mckae.com> wrote in message
news:2t7jm8F1sp752U1@uni-berlin.de...
> "Xenos" <dont.spam.me@spamhate.com> wrote:
> >
> > "Martin Krischik" <krischik@users.sourceforge.net> wrote in message
> > news:1347924.5V7QhTSfdI@linux1.krischik.com...
> > > Unlike C/C++ where you can't switch type safety on even when you
> > desperately
> > > need it.
> > >
> > You obviously know nothing about C++ then.
>
> Don't tell me I can write a class to make this check, no one writes
classes
> to keep track of item counts.  And if I create a CApples class and a
> COranges class that includes quantities and prevents me from mixing Apples
> and Oranges, why is it that _I_ then have to code up the range checking,
> when every Ada programmer would write:
>
>   type Apple_Count  is range 0 .. 500;
>   type Orange_Count is range 0 .. 120_000;
>
> and let the compiler do both type safety and range checking.
>
Your point was not that you disliked the way you "switched on" type safety
in C++.  You said you could not do it; you're point was incorrect.  Don't
make a statement, and when told you're wrong say, "oh, yeah you can do X,
but I don't like X."  Such does not maintain the veracity of your statement.

Nothing prevents you from mixing Apples and Oranges, you just have to tell
C++ how you want this accomplished.  Plus, you can tell the compiler whether
to allow an implicit conversion or not with the explicit keyword.  Weren't
you just arguing for type-safely?  You say C++ is not type-safe, yet you
complain you can't just mix apples and oranges.

Yes, Ada has more type safety than C++, but saying is completely without any
is just plain wrong (even C has *some*).  Yes, its type-safety with
numerical and (decayed) arrays could be better.  Its safety with classes is
very strong.  Enumerations are close, except for allowing implicit
conversion to int and not automatically range-checking.  Even type-safety
for pointer types is very strong, allowing only implicit conversions to
void* and base-class pointer types (it is, of course, missing Ada's strong
scoping rules for access types).





  parent reply	other threads:[~2004-10-14 19:37 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-14  9:05 access & address Hans Van den Eynden
     [not found] ` <1347924.5V7QhTSfdI@linux1.krischik.com>
     [not found]   ` <ckm14i$erb2@cui1.lmms.lmco.com>
2004-10-14 18:09     ` Martin Krischik
2004-10-14 20:13       ` CBFalconer
2004-10-15  8:18         ` Martin Krischik
     [not found]     ` <2t7jm8F1sp752U1@uni-berlin.de>
2004-10-14 18:17       ` Martin Krischik
2004-10-14 19:52         ` Xenos
2004-10-15  8:53           ` Martin Krischik
2004-10-15 17:30             ` Xenos
2004-10-16 14:25               ` Martin Krischik
2004-10-16 15:15                 ` Rich Herrick
2004-10-15 15:46           ` Björn Persson
2004-10-15 17:09             ` Xenos
2004-10-17 23:38               ` Björn Persson
2004-10-18  7:42                 ` Martin Krischik
2004-10-14 19:37       ` Xenos [this message]
2004-10-15  8:30         ` Martin Krischik
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox