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,ed4a5cc4016f9101 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!wns14feed!worldnet.att.net!attbi_s22.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 1.5.0.12 (Windows/20070509) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Default value for a record component References: <1185052757.500324.16860@22g2000hsm.googlegroups.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 12.201.97.213 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s22 1185134519 12.201.97.213 (Sun, 22 Jul 2007 20:01:59 GMT) NNTP-Posting-Date: Sun, 22 Jul 2007 20:01:59 GMT Organization: AT&T ASP.att.net Date: Sun, 22 Jul 2007 20:01:59 GMT Xref: g2news1.google.com comp.lang.ada:16535 Date: 2007-07-22T20:01:59+00:00 List-Id: On Sat, 21 Jul 2007 14:19:17 -0700, Maciej Sobczak wrote: > > package P is > type T is record > V : Integer := Get_Default_Value; > end record; > private > function Get_Default_Value return Integer; > end P; If your function is not very complicated, you can do something like package P is Default_Value : constant Integer; type T is record V : Integer := Get_Default_Value; end record; private Default_Value : constant Integer := 5; end P; If this won't work, and your intention is to keep P's clients from seeing the function, then you'll have to use a private type: package P is type T is private; procedure Put (Into : out T; Value : in Integer); function Get (From : in T) return Integer; private function Get return Integer; type T is record V : Integer := Get; end record; end P; -- Jeff Carter "I'm a kike, a yid, a heebie, a hook nose! I'm Kosher, Mum! I'm a Red Sea pedestrian, and proud of it!" Monty Python's Life of Brian 77