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=0.4 required=5.0 tests=BAYES_00,FORGED_MUA_MOZILLA autolearn=no 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-7-bit Received: by 10.68.15.41 with SMTP id u9mr12105047pbc.3.1322242899662; Fri, 25 Nov 2011 09:41:39 -0800 (PST) Path: lh20ni17223pbb.0!nntp.google.com!news2.google.com!news4.google.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Why constant components are not permitted ? Date: Fri, 25 Nov 2011 18:41:36 +0100 Organization: Tidorum Ltd Message-ID: <9ja2aiFla6U1@mid.individual.net> References: <1856c00b-1994-406a-bbb3-73d93785099a@i6g2000vbe.googlegroups.com> <9j8sg4FfjuU1@mid.individual.net> <14efc07c-744c-4f9a-905b-b9e3ad353e55@cc2g2000vbb.googlegroups.com> Mime-Version: 1.0 X-Trace: individual.net Megp3Ms2CnIQCJe+f5AUqwuHJD57g10ngpkXzxFqtKsT9/XJ3p Cancel-Lock: sha1:DKvdzaTCclAuQP3oPv1GnxChjR8= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 In-Reply-To: <14efc07c-744c-4f9a-905b-b9e3ad353e55@cc2g2000vbb.googlegroups.com> Xref: news2.google.com comp.lang.ada:14659 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Date: 2011-11-25T18:41:36+01:00 List-Id: On 11-11-25 11:06 , AdaMagica wrote: > 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; The original poster specified the constant value in the declaration of the record *type*, not separately for each record *object*. This is what I do not understand: what is the use of a value that is the same for all objects in which it can appear? The "type constants" that Ada now provides are the attributes of a type (tag, size, and so on), as Ludovic pointed out. I understand that some would like to have a "write once" kind of record component that can be given a value once, when a record object is created, and cannot be changed afterwards. Discriminants are like that in Ada, but cannot be of arbitrary type. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .