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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ab1d177a5a26577d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Path: g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!nx02.iad01.newshosting.com!newshosting.com!news.glorb.com!news.alt.net!transit3.readnews.com!news-out.readnews.com!postnews7.readnews.com!not-for-mail Date: Thu, 17 Feb 2011 18:27:35 -0500 From: Hyman Rosen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7 MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: What's wrong with C++? References: <1ee1a434-4048-48f6-9f5e-d8126bebb808@r19g2000prm.googlegroups.com> <4D5C1824.3020509@obry.net> <21443638-5ec6-49d4-aafe-6fbc1e59daba@r19g2000prm.googlegroups.com> <87d2371e-af91-4d6a-8d5b-3ddb972d84fd@k17g2000pre.googlegroups.com> <87zkpuze5e.fsf@ludovic-brenta.org> <4d5d791f$0$17330$882e7ee2@usenet-news.net> <4d5da93f$0$17330$882e7ee2@usenet-news.net> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Message-ID: <4d5daeea$0$17330$882e7ee2@usenet-news.net> NNTP-Posting-Host: 3914ec47.usenet-news.net X-Trace: DXC=QF2L:SdW?@^X1lNlE5mL4^QFZ3T]GPM]WmX0AG3X_jU_iEKWiPgeB1UVjKk:Lk^BNQcR12TN^Bg7^:KNd2lZeh5\Kl On 2/17/2011 6:17 PM, J-P. Rosen wrote: > Le 18/02/2011 00:03, Hyman Rosen a écrit : >> It also occurs to me that the ability to control their internal >> representation makes them seem an awful lot like integers! > I think you might be missing a fundamental point about the typing model > of Ada here. > > There are two levels: an abstract type that pertains to the problem > domain, and an internal representation (which eventually boils down to > bits). In Ada, you work in the problem domain, independently of the > representation. > > Normally, the compiler chooses the internal representation for you. > However, if you need a certain representation, you can impose it on the > compiler; nevertheless, you still work in the abstract domain. > > A typical example of this is what we discussed about the 'Pos attribute: > it is defined as the relative position of an enum in the list where it > is defined. It has nothing to do whatsoever with its internal > representation (although, for efficiency reasons, they are the same /by > default/). I do understand. I don't know Ada, but I would assume that controlling internal representation is generally used to match object layout (not value) against external requirements. (Or to make your arrays of booleans be arrays of bits, I guess.) It seems more unusual, when you want your enumerators to have specific internal values, to also claim that they're not "really" integers.