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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,ed4a5cc4016f9101,start X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!22g2000hsm.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Default value for a record component Date: Sat, 21 Jul 2007 14:19:17 -0700 Organization: http://groups.google.com Message-ID: <1185052757.500324.16860@22g2000hsm.googlegroups.com> NNTP-Posting-Host: 85.3.92.77 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-2" X-Trace: posting.google.com 1185052757 15146 127.0.0.1 (21 Jul 2007 21:19:17 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sat, 21 Jul 2007 21:19:17 +0000 (UTC) User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: 22g2000hsm.googlegroups.com; posting-host=85.3.92.77; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news1.google.com comp.lang.ada:16528 Date: 2007-07-21T14:19:17-07:00 List-Id: Consider: package P is type T is record V : Integer := 5; end record; end P; Above, T.V will have 5 as a default value whenever the instance of T is created without any explicit initialization. I would like extend it and do this: package P is type T is record V : Integer := Get_Default_Value; end record; private function Get_Default_Value return Integer; end P; without losing any of the properties of the original solution and without "leaking" any implementation detail to the public view. The idea is, of course, to compute the default value at run-time, each time the new object is created - but without touching the general "look&feel" of the original code (so that for example Controlled is excluded). Is it possible? -- Maciej Sobczak http://www.msobczak.com/