From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,b30ef5c12f872cb8 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.0.170 with SMTP id 10mr14757454pbf.2.1322302956042; Sat, 26 Nov 2011 02:22:36 -0800 (PST) Path: lh20ni19801pbb.0!nntp.google.com!news2.google.com!news4.google.com!proxad.net!feeder1-2.proxad.net!fdn.fr!feeder.news.orange.fr!not-for-mail Message-ID: <4ED0BDEB.9030002@obry.net> Date: Sat, 26 Nov 2011 11:22:35 +0100 From: Pascal Obry Organization: Home - http://www.obry.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; fr-FR; rv:1.8.1.22) Gecko/20090605 Thunderbird/2.0.0.22 Mnenhy/0.7.5.0 MIME-Version: 1.0 Newsgroups: comp.lang.ada To: AdaMagica Subject: Re: Why constant components are not permitted ? References: <1856c00b-1994-406a-bbb3-73d93785099a@i6g2000vbe.googlegroups.com> <9j8sg4FfjuU1@mid.individual.net> <14efc07c-744c-4f9a-905b-b9e3ad353e55@cc2g2000vbb.googlegroups.com> In-Reply-To: <14efc07c-744c-4f9a-905b-b9e3ad353e55@cc2g2000vbb.googlegroups.com> NNTP-Posting-Date: 26 Nov 2011 11:22:35 CET NNTP-Posting-Host: 83.199.34.6 X-Trace: 1322302955 reader.news.orange.fr 5665 83.199.34.6:13525 X-Complaints-To: abuse@orange.fr Xref: news2.google.com comp.lang.ada:14662 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: 2011-11-26T11:22:35+01:00 List-Id: 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