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,971aa11c293c3db1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-20 05:58:11 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!cyclone.bc.net!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3B581E6B.6FB1DAEF@earthlink.net> From: "Marc A. Criley" Organization: Quadrus Corporation X-Mailer: Mozilla 4.73 [en] (X11; U; Linux 2.2.14-5.0 i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada The Best Language? References: <3B59CD72@MailAndNews.com> <3B5573DA.5ABA8EA7@earthlink.net> <9j94gj$1uk6$1@norfair.nerim.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 20 Jul 2001 12:58:21 GMT NNTP-Posting-Host: 158.252.122.163 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 995633901 158.252.122.163 (Fri, 20 Jul 2001 05:58:21 PDT) NNTP-Posting-Date: Fri, 20 Jul 2001 05:58:21 PDT X-Received-Date: Fri, 20 Jul 2001 05:55:40 PDT (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:10328 Date: 2001-07-20T12:58:21+00:00 List-Id: Bertrand Augereau wrote: > --> (Reinserted from my original response...) > > Consider this: > > > > type Altitude is range 0 .. 50_000; > > Above_Ground : Altitude; > > > > The "defensive" interpretation says that you can now be assured an > > attempt to assign a negative altitude or go into military airspace will > > be immediately caught. <-- > > > > But look at what you get from the "informational" interpretation: > > 'First, 'Last, 'Size, 'Range, 'Address, 'Min, 'Max, 'Image, 'Val, > > 'Pos, 'Value, 'Input, 'Output, 'Read, 'Write, 'Pred, 'Succ, 'Valid, > > 'Wide_Image, 'Wide_Value, 'Wide_Width, 'Width. > > C++ traits address quite nicely this issue. This is odd, having spent the last couple years immersed in C++ projects with very experienced C++ programmers (including co-authoring a C++ Programming Practices standard), I've never encountered anyone suggesting their use, much less employing them. Doing a Google search on "C++ traits" brought up only a handful of relevant entries, the contents of which described it more as a "technique" than a language feature--and a technique available only to templates at that. (Though I may be misinformed regarding this aspect, I'm going by how traits were presented in the various references.) The only reference to something like traits in the MSVC++ Help Index was a "traits_type" data member. Digging further, that did lead to the discovery of MSVC++ supporting the traits technique, though as noted above, only for specific template classes. And not a single one of my C++ books, including "The ANSI/ISO C++ Professional Programmer's Handbook", published in 1999, has an index entry for "traits". While C++ type traits may be a technique to extract type information, its applicability appears limited, and is certainly not available to range constrained scalar type definitions. The use of the technique for other than predefined classes (such as basic_string instantiated with char) appears to require the _developer_ implement the functionality of each trait. Hardly comparable to Ada automatically providing all this information extraction functionality as part of its standard definition. Marc A. Criley Senior Staff Engineer Quadrus Corporation www.quadruscorp.com