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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1901f265c928a511 X-Google-Attributes: gid103376,public Path: controlnews3.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsread.com!newsstand.newsread.com!POSTED.monger.newsread.com!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Typing in Ada From: "Peter C. Chapin" References: <2i1t1lFij4g5U1@uni-berlin.de> Organization: Kelsey Mountain Software Message-ID: User-Agent: Xnews/5.04.25 Date: Tue, 01 Jun 2004 01:04:48 GMT NNTP-Posting-Host: 216.114.178.230 X-Complaints-To: Abuse Role , We Care X-Trace: monger.newsread.com 1086051888 216.114.178.230 (Mon, 31 May 2004 21:04:48 EDT) NNTP-Posting-Date: Mon, 31 May 2004 21:04:48 EDT Xref: controlnews3.google.com comp.lang.ada:968 Date: 2004-06-01T01:04:48+00:00 List-Id: "Nick Roberts" wrote in news:2i1t1lFij4g5U1@uni-berlin.de: > Hehe. I'll think one would find, in practice, that most Ada programs > tend to be far more strongly typed than C programs. That is to say that > in most Ada programs it is typical to have constructions such as: > > type Apples is range 0..100; > type Oranges is range 0..200; > > A: Apples; > O: Oranges; > > whereas in typical C programs you either get: > > typedef int Apples; > typedef int Oranges; > > Apples a; > Oranges o; Yes, Ada provides ranges as distinct types without automatic conversions and that's a nice feature. In theory you could get some of the same benifits in C by introducing an abstract type (as a structure) to hold a range. It could be done much more nicely in C++ using templates, overloaded operators, and other C++ features. The reality is, though, that many C (or C++) programs don't bother. Perhaps they should. It's not clear to me how all this relates to the concept of strong typing. I guess it would be helpful to have a precise definition of that term. It sounds like from what we've said here that strong typing more a matter of programming style than a language feature... at least where C and Ada are concerned. Is that a valid conclusion? Peter