comp.lang.ada
 help / color / mirror / Atom feed
From: Martin <martin.dowie@btopenworld.com>
Subject: Re: Pondering what rationale behind record type
Date: Tue, 10 May 2011 07:20:21 -0700 (PDT)
Date: 2011-05-10T07:20:21-07:00	[thread overview]
Message-ID: <cfb0613e-981d-4691-b700-df1475bd03b3@r35g2000prj.googlegroups.com> (raw)
In-Reply-To: 14o3gst7h97px$.g6k9bn5b3p4q$.dlg@40tude.net

On May 10, 1:50 pm, "Dmitry A. Kazakov" <mail...@dmitry-kazakov.de>
wrote:
> On Tue, 10 May 2011 14:18:28 +0200, Georg Bauhaus wrote:
> > On 10.05.11 14:08, Dmitry A. Kazakov wrote:
>
> >>> Anything wrong with (i.e. makes you shudder)
>
> >>>    Label_A: loop
> >>>      ...
> >>>    end loop Label_A;
>
> >>> ?
>
> >> loop A do
> >>    ...
> >> end A;
>
> > Consequently,
>
> > if ... then A do
> >    ...
> > else
> >    ...
> > end A;
>
> > I guess?
>
> What is the reason to name statements? But if you wanted to, it would be
>
> if A do <condition> then
>    ...
> else
>    ...
> end A;
>
>
>
>
>
>
>
>
>
> >>>    type Get_Token is function (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)
> >>>    end Get_Token;
>
> >> No, Get_Token would be a function-type.
>
> > Yes. It was suggested that the meat part of type declarations
> > should end in "end [X]", not "end keyword", so that
>
> >> E.g.
>
> >     type Func is
> >        function (X : Float) return Float;
> >     end Func;
>
> No, because here there is no left bracket that follows "is". Compare
>
>    type String is array (...) of ...;
>
> The type declaration syntax is:
>
>    type <name> is <definition>;
>
> <definition> can be:
>
> 1. plain, e.g. private; range ...; delta ...; array; access ...; mod ...
>
> 2. nested, like task, record, protected object. Their declarations are
> unfortunately irregular. They should have been
>
>    type Worker is task ... end Worker;
>    type Mutex is protected ... end Mutex;
>    type Data is record ... end Data;
>
> Of course one could deploy the alternative schema:
>
>    <class-name> type <name> is <definition>;
>
> E.g.
>
>    task type A is ... end A;
>    record type B is ... end B;
>    array type String is (Positive range <>) of Character;
>    range type Integer is -2**31-1..2**31-1;
>
> But mixing them was a bad idea.
>
> P.S. task and protected should have been record types with entries being
> primitive operations.
>
> --
> Regards,
> Dmitry A. Kazakovhttp://www.dmitry-kazakov.de

Doesn't 'type' become redundant at this point?...

-- Martin



  reply	other threads:[~2011-05-10 14:20 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
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 [this message]
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