From: Pascal Obry <pascal@obry.net>
To: AdaMagica <christ-usch.grein@t-online.de>
Subject: Re: Why constant components are not permitted ?
Date: Sat, 26 Nov 2011 11:22:35 +0100
Date: 2011-11-26T11:22:35+01:00 [thread overview]
Message-ID: <4ED0BDEB.9030002@obry.net> (raw)
In-Reply-To: <14efc07c-744c-4f9a-905b-b9e3ad353e55@cc2g2000vbb.googlegroups.com>
Le 25/11/2011 11:06, AdaMagica a �crit :
> Useful applications for constant components could be (this is what you
> can have in C++):
>
> record -- *not* Ada
> Name: constant String := "James Bond";
> Id : constant Positive := 007; -- e.g employee number of a company
> other variable components
> end record;
>
> In Ada, you hide the components (private record), define a constructor
> function providing the values for the constant items and provide only
> read operations for them.
But why on earth do you want a field in a record with the same value for
all objects of this type?
This looks like an application wide constant, so just declare the
constant value outside of the record.
Pascal.
--
--|------------------------------------------------------
--| Pascal Obry Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--| http://www.obry.net - http://v2p.fr.eu.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver keys.gnupg.net --recv-key F949BD3B
next prev parent reply other threads:[~2011-11-26 10:22 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-24 18:14 Why constant components are not permitted ? David Sauvage
2011-11-24 19:06 ` anon
2011-11-24 19:49 ` David Sauvage
2011-11-24 22:55 ` Georg Bauhaus
2011-11-24 23:53 ` anon
2011-11-24 19:46 ` Ludovic Brenta
2011-11-25 9:10 ` Dmitry A. Kazakov
2011-11-25 10:23 ` Ludovic Brenta
2011-11-25 10:45 ` Dmitry A. Kazakov
2011-11-25 6:56 ` Niklas Holsti
2011-11-25 9:53 ` Yannick Duchêne (Hibou57)
2011-11-25 10:06 ` AdaMagica
2011-11-25 10:16 ` AdaMagica
2011-11-25 10:56 ` Yannick Duchêne (Hibou57)
2011-11-25 17:41 ` Niklas Holsti
2011-11-26 0:23 ` anon
2011-11-29 4:10 ` Randy Brukardt
2011-11-29 7:55 ` David Sauvage
2011-11-29 10:55 ` Yannick Duchêne (Hibou57)
2011-11-29 11:17 ` Mark Lorenzen
2011-11-26 10:22 ` Pascal Obry [this message]
2011-11-26 10:59 ` Dmitry A. Kazakov
2011-11-25 7:03 ` AdaMagica
2011-11-25 9:12 ` Dmitry A. Kazakov
2011-11-25 9:57 ` Yannick Duchêne (Hibou57)
2011-11-25 10:22 ` Dmitry A. Kazakov
2011-11-25 11:00 ` Yannick Duchêne (Hibou57)
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox