comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Pondering what rationale behind record type
Date: Tue, 10 May 2011 00:03:37 +0200
Date: 2011-05-10T00:03:37+02:00	[thread overview]
Message-ID: <4dc864b9$0$6890$9b4e6d93@newsspool2.arcor-online.net> (raw)
In-Reply-To: <defadb27-a92e-43a4-ae34-b399ee84e266@d28g2000yqf.googlegroups.com>

On 5/9/11 10:12 PM, Anh Vo wrote:
> On May 9, 1:02 pm, "Dmitry A. Kazakov"<mail...@dmitry-kazakov.de>
> wrote:
>> On Mon, 09 May 2011 22:51:42 +0300, Niklas Holsti wrote:
>>> Adam Beneschan wrote:
>>>> 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.
>>
>>> I make that mistake often, too. I would vote for a change in the
>>> language to allow "end Some_Type" as an alternative to "end record".
>>
>> Count me in.
>
> I am in automatically.
>
> I am hoping that it is still time to put it in Ada 2012. Of course, we
> need to hear from Randy, Tucker and others first.

I'll advocate (and speculate) against, even though I frequently type
"end R" when I should type "end record" (of have my editor expand it
for me).  There might be a fix, though.

I'll list a few points that refer to bracketing constructs that
I think are nicely specific. They make "end record" a logical choice,
but not "end R".

First, in the phrase "end X", the "X" part can usually be omitted.
To have just "end [R]" in record declarations is less specific
(specifically finishing off record declarations), and less informative
than "end record".

Second, in "end [X]", where X is a name, the corresponding left bracket
for "end" either is "begin" or we have seen something that wraps
around declarations of callable constructs, if I'm not missing something.

So whenever we put "record" (or "case", or "if", etc) after an "end",
this is delimiting a bracketed construct that is neither a block
nor a {package, task, protected}. A piece of syntax that helps
the reader keeping different things apart.

By reversing things for reasons of contrasting the options,
assume "package ... end package;" is suggested as a replacement
of the current syntax.  Wouldn't you instead want
"package P ... end package P;" instead?  Fortran and ParaSail
have these conventions, I think.

Consequently, how about this addition to the syntax of record
declarations:

    type R is
      record
         ...
      end record R;

?



  reply	other threads:[~2011-05-09 22:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-09 17:47 Pondering what rationale behind record type Anh Vo
2011-05-09 18:59 ` Adam Beneschan
2011-05-09 19:51   ` Niklas Holsti
2011-05-09 20:02     ` Dmitry A. Kazakov
2011-05-09 20:12       ` Anh Vo
2011-05-09 22:03         ` Georg Bauhaus [this message]
2011-05-10  7:45           ` Dmitry A. Kazakov
2011-05-10 10:12             ` Georg Bauhaus
2011-05-10 12:08               ` Dmitry A. Kazakov
2011-05-10 12:18                 ` Georg Bauhaus
2011-05-10 12:50                   ` Dmitry A. Kazakov
2011-05-10 14:20                     ` Martin
2011-05-11  7:32                       ` Dmitry A. Kazakov
2011-05-11  2:28                     ` Shark8
2011-05-11  7:32                       ` Dmitry A. Kazakov
2011-05-18 22:55                         ` Shark8
2011-05-19  8:12                           ` Dmitry A. Kazakov
2011-05-09 20:49   ` Randy Brukardt
2011-05-19  9:50 ` J-P. Rosen
2011-05-20  6:10 ` anon
replies disabled

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