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-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!feeder.news-service.com!newsfeed.straub-nv.de!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!jacob-sparre.dk!ada-dk.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Pondering what rationale behind record type Date: Mon, 9 May 2011 15:49:36 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <90148303-4dc4-4c05-882f-88dd69a95494@z13g2000prk.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1304974180 28250 69.95.181.76 (9 May 2011 20:49:40 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Mon, 9 May 2011 20:49:40 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Xref: g2news2.google.com comp.lang.ada:20173 Date: 2011-05-09T15:49:36-05:00 List-Id: "Adam Beneschan" wrote in message news:90148303-4dc4-4c05-882f-88dd69a95494@z13g2000prk.googlegroups.com... On May 9, 10:47 am, Anh Vo wrote: >> Some time I am wondering why record type has different syntax pattern >> than the rest with respect to type ending text. ... >Heh ... good question. I have to say I get tripped up by this a lot; >I type things like "type Some_Type is record ... end Some_Type;" >fairly frequently, and sometimes I don't catch it before the compiler >does. > >Maybe the BNF gives a clue. In Ada 83, the "task type" and "end" were >part of the same syntax definition, so it was clear that the "end" >ended the "task type" and thus sort of belonged to it; while the >"record" and "end record" keywords were part of the >"record_type_definition" syntax rule, which is separate from the rule >that contains "type identifier [discriminant_part] is >type_definition;", so maybe they didn't want an "end" in one syntax >rule to refer to something in another rule. Just a wild guess, but >perhaps that's the rationale for the original syntax. (Note that this >doesn't apply in Ada 95+ since the "end" of a task type is now in a >different syntax rule. I'm just speculating about the original >rationale.) I would guess that you have most of the reason. My guess (and I don't know anything more about this than you do) is that the definition syntax exists to allow for anonymous types. If you had an anonymous record type, it would be hard to write the matching identifier. :-) But most of the anonymous types were stripped out of Ada early on, because they caused problems with where declarations happened (think about the rules of 7.3.1 applied to nested, anonymous types - gag!) And they forgot to change the syntax. Every once in a while, someone has suggested some sort of fix for this syntax glitch (I think it affects everyone), but we've never actually followed through. Probably someone should send a request to Ada-Comment so it makes it onto an agenda someday. Randy.