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,75ffc1f081ec10e3 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed01.chello.at!newsfeed.arcor.de!news.arcor.de!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Constant record components From: Georg Bauhaus In-Reply-To: <12adcn2kslq7d80@corp.supernews.com> References: <12ad8guf3sg1o0d@corp.supernews.com> <1loq7utmaxvll$.yqsxj5edzqgv.dlg@40tude.net> <12adcn2kslq7d80@corp.supernews.com> Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: # Message-ID: <1151778788.25270.4.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Date: Sat, 01 Jul 2006 20:33:08 +0200 NNTP-Posting-Date: 01 Jul 2006 20:32:53 MEST NNTP-Posting-Host: b2eadc5b.newsread4.arcor-online.net X-Trace: DXC=X4PLELoeVbHl=9hLK`A7fM:ejgIfPPldDjW\KbG]kaMHLL]:kiR8f=O^7Fe\75PN7JhP3YJKgE\jLaWoMIdPfi[@_oHF]]1bjGI X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:5397 Date: 2006-07-01T20:32:53+02:00 List-Id: On Sat, 2006-07-01 at 10:37 -0700, ME wrote: > What I meant was components that can not be changed after the record > components are initialized. > I can not use Record discriminanats because I have a two dimensional > unconstrained array of these records. You could use "component notation" with a suitable function in Ada 2005, package rec is type R is tagged private; function make(m: INTEGER) return R; -- `m` is the initial value for the immutable component function immutable(thing: R) return INTEGER; private type R is tagged record mutable: INTEGER; data: INTEGER; end record; pragma inline(immutable); end rec; x: rec.R; n: INTEGER; begin n := x.immutable; -- Ada 2005 x.immutable := n; -- illegal to assign to function result