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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.68.253.66 with SMTP id zy2mr4572363pbc.1.1400919597865; Sat, 24 May 2014 01:19:57 -0700 (PDT) X-Received: by 10.140.21.233 with SMTP id 96mr8508qgl.19.1400919597750; Sat, 24 May 2014 01:19:57 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!c1no15741903igq.0!news-out.google.com!qf4ni12380igc.0!nntp.google.com!c1no15741865igq.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Sat, 24 May 2014 01:19:57 -0700 (PDT) In-Reply-To: <70638024-2a8b-45e1-aea4-5964f4416abf@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=93.37.86.173; posting-account=9fwclgkAAAD6oQ5usUYhee1l39geVY99 NNTP-Posting-Host: 93.37.86.173 References: <29a09fe5-72c0-40e0-bf72-632c4a13232e@googlegroups.com> <70638024-2a8b-45e1-aea4-5964f4416abf@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <092ceab9-9d9a-4689-b31b-39686f030358@googlegroups.com> Subject: Re: What is the difference of "with null record" and "with private"? From: mockturtle Injection-Date: Sat, 24 May 2014 08:19:57 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:20003 Date: 2014-05-24T01:19:57-07:00 List-Id: On Friday, May 23, 2014 9:42:06 PM UTC+2, Adam Beneschan wrote: > On Friday, May 23, 2014 11:55:09 AM UTC-7, mockturtle wrote: >=20 > > On Friday, May 23, 2014 8:21:21 PM UTC+2, Victor Porton wrote: >=20 >=20 >=20 > > One could say that "with private" is used to hide the internal details = of your type and that if the extension is done with a "null record" there i= s not much to hide. Actually, I cannot imagine a case where the fact that i= t is public that the extension is null can cause loss of maintainability th= e day some new fields are added. Nevertheless, usually I prefer the "with = private" form for uniformity. >=20 >=20 >=20 > I can easily imagine a case. (snip) > The point here is that when declaring an aggregate of type An_Extension, = the program can count on the fact that the extension has no additional fiel= ds, while for A_Private_Extension, it can't. **The fact that A_Private_Ext= ension has no additional fields is an implementation detail that is hidden = from the rest of the program.** It's not true that there is "nothing to hi= de" ... the fact that there are no details is definitely something that may= need to be hidden. Suppose that you later change the implementation of Pa= ck1 and decide to add some fields to A_Private_Extension. Since the implem= entation details are hidden, you can change them without worrying that you = will break something else in some other package far, far away. (This would= n't be true if the declaration of A2 were legal.) And that's the whole pur= pose of "private" and the whole purpose of encapsulation in general--so tha= t hidden implementation details can be changed without worrying about havin= g to search every user of the package to see if it needs to change. >=20 Touche'. You are right.