From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c6ca9cbe17b867c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!213.200.89.82.MISMATCH!tiscali!newsfeed1.ip.tiscali.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: access & address Date: Fri, 15 Oct 2004 10:30:46 +0200 Organization: AdaCL Message-ID: <1957126.ShjE8HKL3e@linux1.krischik.com> References: <1c2f5137.0410140105.66fdb23e@posting.google.com> <1347924.5V7QhTSfdI@linux1.krischik.com> <2t7jm8F1sp752U1@uni-berlin.de> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.t-online.com 1097829269 03 29278 VSkRXU0JVL6yXUN 041015 08:34:29 X-Complaints-To: usenet-abuse@t-online.de X-ID: EGqOf0ZYgeFXI+RiPBvm2Fj+eH3Ve2FyWRsLcpjSxww6kSb0iTapET User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:5242 Date: 2004-10-15T10:30:46+02:00 List-Id: Xenos wrote: > > "Marc A. Criley" wrote in message > news:2t7jm8F1sp752U1@uni-berlin.de... >> "Xenos" wrote: >> > >> > "Martin Krischik" 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++. Not not about dislike. The problem is that we all have to work with 3rd party libraries - and non of the other do it. Only features which are used by the mayoritiy of the developers of a give language are true features. The rest is just academic talk. > 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. When "explicit" was invented the C++ designers missed to one off change for: typedef explicit int Apple_Count; typedef explicit int Orange_Count; Then perhaps the STL would have used "typedef explicit" - and them most of the C++ developers as well. And then we would have type safety. As it is is I have seen things like the following more then once: std:string X = ...; int X_Len = X.length (); (std::string::lenght () returns size_t and not int) With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com