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!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!sn-xt-sjc-03!sn-xt-sjc-10!sn-xt-sjc-09!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail From: "ME" Newsgroups: comp.lang.ada Subject: Re: Constant record components Date: Wed, 12 Jul 2006 23:58:54 -0700 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <12bbrq2lqngr807@corp.supernews.com> References: <12ad8guf3sg1o0d@corp.supernews.com> <1loq7utmaxvll$.yqsxj5edzqgv.dlg@40tude.net> <12afs64kh432q0e@corp.supernews.com> <12aihj2lrjqpc3a@corp.supernews.com> <7bednaJHX_FTMDTZnZ2dnUVZ_uudnZ2d@megapath.net> <12ak5urrrj6d756@corp.supernews.com> <12arsrtbe8flpf8@corp.supernews.com> <1152263715.5568.1.camel@localhost> <12avmdo6nl3g876@corp.supernews.com> <44afe7b2$0$29128$9b4e6d93@newsread4.arcor-online.net> X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.2869 X-RFC2646: Format=Flowed; Response X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2869 X-Complaints-To: abuse@supernews.com Xref: g2news2.google.com comp.lang.ada:5656 Date: 2006-07-12T23:58:54-07:00 List-Id: "Georg Bauhaus" wrote in message news:44afe7b2$0$29128$9b4e6d93@newsread4.arcor-online.net... > ME wrote: >> "Georg Bauhaus" wrote in message >> news:1152263715.5568.1.camel@localhost... >>> On Thu, 2006-07-06 at 22:39 -0700, ME wrote: >>>> What I am looking for is a way to read in a values from a file ,assign >>>> them >>>> once to records and disallow any future assignment i.e. these >>>> "constant >>>> parts of the records represent a structure that I don't want to ever >>>> change >>>> during the life of the program (write once and read only afterwards). >>> Wouldn't it be an option to declare the public view >>> of the to-be-constant record subtype limited? >> The record has no discriminants > > Yes. What I meant has in fact little to do with discriminants. > package P is > > type C is limited private; > -- to be the constant part in R -- C ops ... > > type R is record -- cannot be assigned because but I need R to be assigned anyway the unconstrained array of records R is private > immutable: C; -- this cannot be assigned either (read only) > other_data: Integer; -- (read/write) > end record; > > type Grid is array(...) of R; > > -- etc. > > private > type C is record > mutable: Integer; -- can be assigned, e.g. during init > end record; > > -- perform initialization in package body, maybe require > -- a suitable callback that reads initial values > -- ... > > end P;