From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Pondering what rationale behind record type
Date: Tue, 10 May 2011 14:50:50 +0200
Date: 2011-05-10T14:50:50+02:00 [thread overview]
Message-ID: <14o3gst7h97px$.g6k9bn5b3p4q$.dlg@40tude.net> (raw)
In-Reply-To: 4dc92d14$0$6776$9b4e6d93@newsspool3.arcor-online.net
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. Kazakov
http://www.dmitry-kazakov.de
next prev parent reply other threads:[~2011-05-10 12:50 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 [this message]
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