comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <sb463ba@l1-hrz.uni-duisburg.de>
Subject: Re: enumeration type
Date: Mon, 27 Sep 2004 14:19:03 +0000 (UTC)
Date: 2004-09-27T14:19:03+00:00	[thread overview]
Message-ID: <cj97gn$dlj$1@a1-hrz.uni-duisburg.de> (raw)
In-Reply-To: vo7j6vq7np90.hj8obmhkkc7w.dlg@40tude.net

Dmitry A. Kazakov <mailbox@dmitry-kazakov.de> wrote:
:> If you don't dislike writing down what you want to say,
:> you can use qualified notation:


:>    if b = Boolean'(True) and v = Ternary_Logical'(True) then

: What for?

Rick asked,
"How can I now access the True-element from the original Standard.Boolean
type?"

Then, sometimes it is not necessary to stress that v is of type
Ternary_Logical or b of type Boolean, or to mention True at all
as in Peter Hermann's example. Sometimes added qualification
helps (me) understanding the software if there is some redundant
type information, because it reduces the need to look at context.

For example, if your function returns a value of record type Foo,
you could write

   return (bar => 7, baz => comp_result);

or
   return Foo'(bar => 7,
               baz => comp_result);  (*)

or 
   return (7, comp_result);		(**)

or
   return Foo'(7, comp_result);

In cases ** is just fine for me, in other cases I like * because
it unambiguously tells me, the reader, what is returned.

Aggregates must be qualified in SPARK, iirc.


-- Georg



  reply	other threads:[~2004-09-27 14:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-27  0:13 enumeration type Rick Santa-Cruz
2004-09-27  0:54 ` Jack Flynn
2004-09-27  1:26 ` Stephen Leake
2004-09-27  7:38 ` Dmitry A. Kazakov
2004-09-27 13:40   ` Larry Hazel
2004-09-27 14:09     ` Dmitry A. Kazakov
2004-09-27  9:45 ` Peter Hermann
2004-09-27 12:51   ` Georg Bauhaus
2004-09-27 13:43     ` Dmitry A. Kazakov
2004-09-27 14:19       ` Georg Bauhaus [this message]
2004-09-27 14:48         ` Dmitry A. Kazakov
2004-09-27 17:18           ` Georg Bauhaus
replies disabled

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