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,a9bab26b6fe54a36 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder3.cambriumusenet.nl!feed.tweaknews.nl!212.27.60.9.MISMATCH!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool3.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Pondering what rationale behind record type 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: <90148303-4dc4-4c05-882f-88dd69a95494@z13g2000prk.googlegroups.com> <92quueFnsfU1@mid.individual.net> <4dc864b9$0$6890$9b4e6d93@newsspool2.arcor-online.net> Date: Tue, 10 May 2011 09:45:24 +0200 Message-ID: NNTP-Posting-Date: 10 May 2011 09:45:24 CEST NNTP-Posting-Host: e89fa840.newsspool1.arcor-online.net X-Trace: DXC=>Ng^eH3ghd=_A0jCfgHO6>ic==]BZ:af>4Fo<]lROoR1<`=YMgDjhg2ZYUBk^8eT;9[6LHn;2LCV>7enW;^6ZC`4\`mfM[68DC3DN=0Q3ib2F3 X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:20182 Date: 2011-05-10T09:45:24+02:00 List-Id: On Tue, 10 May 2011 00:03:37 +0200, Georg Bauhaus wrote: > First, in the phrase "end X", the "X" part can usually be omitted. That is another fix to do: a default profile which would forbid omitting the name. I saw no Ada program in my life which omitted names in the ends. > So whenever we put "record" (or "case", or "if", etc) after an "end", These are anonymous constructs. The only reason why record bracket should not contain its name is when there is no name, e.g. as Randy has pointed out, in an anonymous record type. They are illegal in Ada, but an imaginary example could be: function Get_Token (File : File_Type) return (Matched : Boolean; Length : Positive) record case Matched is when True => Token : String (1..Length); when False => null; end case; end record; The result is this anonymous record: type (Matched : Boolean; Length : Positive) is record case Matched is when True => Token : String (1..Length); when False => null; end case; end record; We could continue the exercise with other types: function Get_Handle (...) return new Ada.Finalization.Controlled with record ... end record; function Get_List (...) return array (Positive range <>) of Element; Do you like it? (:-)) > Consequently, how about this addition to the syntax of record > declarations: > > type R is > record > ... > end record R; > > ? Shudder. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de