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,24d7acf9b853aac8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!usenet-fr.net!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!news.weisnix.org!newsfeed.ision.net!newsfeed2.easynews.net!ision!newsfeed.arcor.de!newsspool2.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: S-expression I/O in Ada Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <547afa6b-731e-475f-a7f2-eaefefb25861@k8g2000prh.googlegroups.com> <984db477-973c-4a66-9bf6-e5348c9b95f2@n19g2000prf.googlegroups.com> <46866b8yq8nn$.151lqiwa0y2k6.dlg@40tude.net> <13b07f2c-2f35-43e0-83c5-1b572c65d323@y11g2000yqm.googlegroups.com> <13tpf7ya3evig$.h05p3x08059s$.dlg@40tude.net> <1omt2srxtpsga$.c3hbxthzo6cf.dlg@40tude.net> <1e4cch2df5uyb.18brqdd16dhv8.dlg@40tude.net> <14y70ke8am9qw$.2csc9eflvigg.dlg@40tude.net> <4c601b5c$0$7665$9b4e6d93@newsspool1.arcor-online.net> <9czktq4ntzq7.fhbsnocx0x4w$.dlg@40tude.net> Date: Mon, 9 Aug 2010 21:59:06 +0200 Message-ID: NNTP-Posting-Date: 09 Aug 2010 21:59:06 CEST NNTP-Posting-Host: 6dcd0dca.newsspool2.arcor-online.net X-Trace: DXC=OS`kj4M?LnV\9P[:DUn00QA9EHlD;3YcR4Fo<]lROoRQ8kF On Mon, 09 Aug 2010 12:47:45 -0400, Robert A Duff wrote: > "Dmitry A. Kazakov" writes: > >> 1. The membership/subset tests look even worse > > We're talking about bit maps now, right? Yes > Membership is "if Flags(X)...". Subset is > "if Is_Subset(These_Flags, Those_Flags)...". > The body of Is_Subset says, "(X and Y) = X". > > Not so horrible. But a lot of manual work. The type should just do what you expect it to do. >> 2. No ranges >> 3. No loops > > I don't know what you want ranges and loops for. A subset of flags. E.g. Critical_Errors, Warnings, Any_Error. > If you really want these, you can Unchecked_Convert to > integer (signed range 0..2**something). But only if > something is small. > >> 4. No case statement > > Yeah, that's a shame. I'd like to have case statements > on bit maps, but also on other composite types. Yes, it is a type property that the domain is a set of identifiable values, in fact, some mapping to an enumeration. The language should provide means to implement this interface with any type. E.g. why I cannot specify this interface for String to be able to write: case Get_Token is when "type" => ... when "package" => ... when others => raise Syntax_Error; end case; >> 6. No discriminants of > > I'm not sure why you'd want discriminants of bit maps, > but I agree that discriminants should be more general. type Message (Urgency : Alarm_Type) is ... >> Note that array must be a view of a modular type with the modulus 2**N, but >> the type itself must remain scalar. > > All Ada compilers support: > > type Index is range 0..100; > type Bit_Map is array (Index) of Boolean;". > > And this: > > type Bit_Map is array (Character) of Boolean;". > > But no Ada compilers support this: > > type Bit_Map is mod 2**100; Why not? It is not that difficult to implement mod 2**100 or range -2**1_000_000..2**1_000_000+1. I think the standard should require it on any hardware. >> Most of modular types should have no + at all. There should be a readable >> notation for X+1 instead of infernal T'Succ(X) > > What notation would you like? > > How about: > > function Succ (...) return ... renames T'Succ; It should be something more like an operator. The problem is that generics should understand it without passing around as an extra parameter. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de