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 Path: g2news1.google.com!postnews.google.com!z13g2000prk.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Pondering what rationale behind record type Date: Mon, 9 May 2011 11:59:45 -0700 (PDT) Organization: http://groups.google.com Message-ID: <90148303-4dc4-4c05-882f-88dd69a95494@z13g2000prk.googlegroups.com> References: NNTP-Posting-Host: 66.126.103.122 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1304967585 18916 127.0.0.1 (9 May 2011 18:59:45 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 9 May 2011 18:59:45 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: z13g2000prk.googlegroups.com; posting-host=66.126.103.122; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; WOW64; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 3.5.30729; .NET CLR 3.0.30618; .NET4.0C),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:19197 Date: 2011-05-09T11:59:45-07:00 List-Id: On May 9, 10:47=A0am, Anh Vo wrote: > Some time I am wondering why record type has different syntax pattern > than the rest with respect to type ending text. That is it ends with > 'end record;' no matter what the identifier is. The rest of others end > with 'end identifier'. Below are examples regarding this subject. > > type Data is record > =A0 =A0X_Coord : Integer :=3D 0; > =A0 =A0Y_Coord : Integer :=3D 0; > =A0 =A0 -- more components > end record; > > task type Event_Monitor is > =A0 =A0 entry Start; > =A0 =A0 entry Process (...) > end Event_Monitor; 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.) -- Adam