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=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.67.14.194 with SMTP id fi2mr44615315pad.29.1436796141323; Mon, 13 Jul 2015 07:02:21 -0700 (PDT) X-Received: by 10.182.165.8 with SMTP id yu8mr250540obb.37.1436796141287; Mon, 13 Jul 2015 07:02:21 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!news.glorb.com!pg9no317431igb.0!news-out.google.com!a16ni16781ign.0!nntp.google.com!pg9no317427igb.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 13 Jul 2015 07:02:21 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=74.203.194.21; posting-account=bXcJoAoAAAAWI5APBG37o4XwnD4kTuQQ NNTP-Posting-Host: 74.203.194.21 References: <14592326-5070-4663-a864-5684298f3748@googlegroups.com> <004361da-53c4-4ea9-8cc6-38944aa6c7ad@googlegroups.com> <29dd5458-f9ce-4db8-9128-8ab35a9ce5f8@googlegroups.com> <64bc671c-72e5-4924-b703-3b907c69949c@googlegroups.com> <877fq9uj6g.fsf@theworld.com> <65061686-5c8f-433b-9b11-9e228298158e@googlegroups.com> <87k2u96jms.fsf@jester.gateway.sonic.net> <06f8a6f9-d219-4d40-b9ac-8518e93839bd@googlegroups.com> <87y4io63jy.fsf@jester.gateway.sonic.net> <7a29d3e9-d1bd-4f4a-b1a6-14d3e1a83a4d@googlegroups.com> <87mvz36fen.fsf@jester.gateway.sonic.net> <2215b44f-8a89-47c6-a4c4-52b74d2dac45@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <9e492c82-868d-43d3-a18a-38274400e337@googlegroups.com> Subject: Re: If not Ada, what else... From: Patrick Noffke Injection-Date: Mon, 13 Jul 2015 14:02:21 +0000 Content-Type: text/plain; charset=ISO-8859-1 Xref: news.eternal-september.org comp.lang.ada:26802 Date: 2015-07-13T07:02:21-07:00 List-Id: On Saturday, July 11, 2015 at 5:48:13 AM UTC-5, Brian Drummond wrote: > On Fri, 10 Jul 2015 12:43:55 -0700, Patrick Noffke wrote: > > > On Friday, July 10, 2015 at 2:10:44 PM UTC-5, David Botton wrote: > >> > I may be missing something here, but I don't see where Ada's type > >> > system is that much better than C++'s, > >> > >> So in C++ you can create new incompatible types with various ranges, > >> use them for array indexes, true enums? > >> > >> > > In C++11 you have enum class which makes an enum its own type. You can > > still cast it to the class type, but you can't willy-nilly use it as an > > int as with the old-style enum. > > > > This generates an error: > > > > enum class Junk : int { > > One, Two, Three > > }; > > > > int a = Junk::One; // error: cannot convert to int > > > > Where this is allowed: > > > > int a = (int) Junk::One; > > And you can loop over the enum range (without explicitly naming its first > and last tokens), and index arrays with them, etc, right? > Um, no. Adding enum class was a baby step in the right direction. I'm a bit surprised though that range-based for loops don't work over an enum class. Seems there's interest in doing so: http://stackoverflow.com/questions/8498300/allow-for-range-based-for-with-enum-classes Pat