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 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!r34g2000hsd.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Default value for a record component Date: Sun, 22 Jul 2007 12:44:02 -0700 Organization: http://groups.google.com Message-ID: <1185133442.532463.301960@r34g2000hsd.googlegroups.com> References: <1185052757.500324.16860@22g2000hsm.googlegroups.com> NNTP-Posting-Host: 85.0.241.122 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1185133442 10537 127.0.0.1 (22 Jul 2007 19:44:02 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Sun, 22 Jul 2007 19:44:02 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.5) Gecko/20070713 Firefox/2.0.0.5,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: r34g2000hsd.googlegroups.com; posting-host=85.0.241.122; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news1.google.com comp.lang.ada:16533 Date: 2007-07-22T12:44:02-07:00 List-Id: On 22 Lip, 10:08, "Dmitry A. Kazakov" > > 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. > Yes: > > package P is > function Get_Default_Value return Integer; > type T is record > V : Integer := Get_Default_Value; > end record; > end P; No, this leaks the implementation detail (the Get_Default function) to the public view and pollutes it. I don't want my users to even see it. Ada needs real constructors, not just initial values. -- Maciej Sobczak http://www.msobczak.com/