comp.lang.ada
 help / color / mirror / Atom feed
From: Adam Beneschan <adam@irvine.com>
Subject: Re: Real syntax problems in Ada
Date: Tue, 28 Aug 2012 16:09:56 -0700 (PDT)
Date: 2012-08-28T16:09:56-07:00	[thread overview]
Message-ID: <767cba0f-4116-4a59-8e1d-d186b283e481@googlegroups.com> (raw)
In-Reply-To: <k1ject$ip6$1@munin.nbi.dk>

On Tuesday, August 28, 2012 2:49:20 PM UTC-7, Randy Brukardt wrote:

> >> 2. "end record" instead of "end <record type name>";
> 
> >
> 
> >Yep, this is one I wish were different.  After working with Ada for about 
> >24 years
> > I still sometimes type in "end <type-name>" before I catch myself.

> I feel that way too, but there is a semantic reason why this isn't possible. 
> Specifically, the part after the "is" of a type declaration is a "type 
> definition". These are anonymous and can appear in various other contexts 
> (anonymous array and access types, for instance). The name of a type comes 
> from the type declaration, which is a separate semantic entity (and has 
> subtly different rules). I know that Janus/Ada processes "type definitions" 
> separately from the declarations, and thus including a name in the anonymous 
> part would be difficult to manage.
> 
> I once seriously looked at proposing allowing a name in a record type 
> declaration, and I couldn't figure out a reasonable way to do so given the 
> existing Ada semantics. Figuring out some way to hack the wording so that 
> the name associated with the declaration somehow can be matched in the 
> definition would seem to require changes all over the standard all out of 
> proportion to the size of the problem. So I don't think this is ever going 
> to happen.

Off the top of my head, it seems like you could modify 3.8 to allow "end <identifier>" in a record_type_definition, without saying anything in the Legality Rules (in 3.8) about the identifier.  Then, in 3.2.1, you can add a Legality Rule that if a full_type_declaration includes a record_type_definition, and the record_type_definition ends with "end <identifier>", then the identifier name must match the defining_identifier of the type declaration.  This would mean that if a record_type_definition is used anywhere else besides a full_type_declaration, then the identifier could be anything you want, which would be weird.  But that's not a real problem, since record_type_definition is used only in one place in the syntax.  It seems a little hacky since the Legality Rule would be in the wrong place, but I think it would work and wouldn't affect anything else in the RM.  

                             -- Adam



  reply	other threads:[~2012-08-28 23:09 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-28  8:13 Real syntax problems in Ada Dmitry A. Kazakov
2012-08-28 10:20 ` Georg Bauhaus
2012-08-28 10:47 ` Niklas Holsti
2012-08-28 11:33   ` J-P. Rosen
2012-08-31 13:35     ` Robert A Duff
2012-08-28 13:27 ` Vasiliy Molostov
2012-08-28 15:23   ` Dmitry A. Kazakov
2012-08-28 20:18     ` Vasiliy Molostov
2012-08-29  7:25       ` Dmitry A. Kazakov
2012-08-29 10:47         ` Vasiliy Molostov
2012-08-29 11:58           ` Dmitry A. Kazakov
2012-08-30 17:38             ` Vasiliy Molostov
2012-08-28 15:14 ` Adam Beneschan
2012-08-28 16:18   ` J-P. Rosen
2012-08-28 16:39   ` Dmitry A. Kazakov
2012-08-28 21:38     ` Randy Brukardt
2012-08-29  6:58       ` Dmitry A. Kazakov
2012-08-29 10:43         ` stefan-lucks
2012-08-29 10:58           ` stefan-lucks
2012-08-29 13:14           ` Niklas Holsti
2012-08-29 17:52             ` stefan-lucks
     [not found]             ` <fbps38pgcuf8fgioptt39s6u7dme1aqs7r@invalid.netcom.com>
2012-09-02 10:16               ` svaa
2012-08-29 13:33           ` Georg Bauhaus
2012-08-29 17:20             ` Jeffrey Carter
2012-08-29 17:51             ` stefan-lucks
2012-08-30  9:12               ` Georg Bauhaus
2012-08-28 21:49   ` Randy Brukardt
2012-08-28 23:09     ` Adam Beneschan [this message]
2012-08-29  7:34     ` Egil Høvik
2012-08-28 19:41 ` Florian Weimer
2012-08-28 20:53   ` Shark8
2012-08-28 21:07     ` Adam Beneschan
2012-08-28 21:25       ` Shark8
2012-08-28 22:59         ` Adam Beneschan
2012-08-29  7:06       ` Dmitry A. Kazakov
2012-08-30 21:08         ` Randy Brukardt
2012-08-30 22:06 ` sbelmont700
2012-08-30 22:34   ` Adam Beneschan
2012-08-30 22:54     ` William Findlay
2012-08-31  7:39     ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox