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.236.84.239 with SMTP id s75mr1003148yhe.28.1389800457510; Wed, 15 Jan 2014 07:40:57 -0800 (PST) X-Received: by 10.50.152.41 with SMTP id uv9mr55625igb.13.1389800457341; Wed, 15 Jan 2014 07:40:57 -0800 (PST) Path: border1.nntp.dca.giganews.com!nntp.giganews.com!p15no16079036qaj.0!news-out.google.com!gg4ni4085qab.0!nntp.google.com!6no11724173qao.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Wed, 15 Jan 2014 07:40:56 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=KSa2aQoAAACOxnC0usBJYX8NE3x3a1Xq NNTP-Posting-Host: 66.126.103.122 References: <839fee13-2743-49f6-a7f3-f95578386201@googlegroups.com> <1aav8alqsnqqv.5urmifgwh1mv.dlg@40tude.net> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: 'Protected' abstract subprograms From: adambeneschan@gmail.com Injection-Date: Wed, 15 Jan 2014 15:40:57 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: number.nntp.dca.giganews.com comp.lang.ada:184431 Date: 2014-01-15T07:40:56-08:00 List-Id: On Wednesday, January 15, 2014 6:11:03 AM UTC-8, Robert A Duff wrote: > I think the principle is: >=20 > The private part cannot affect the legality of clients. >=20 > It seems like a good principle, but it is violated all over the place. > Search for "see 12.3" in the RM to find a bunch. For example: >=20 > generic > type Formal is tagged limited private; > package A is > private > task type T; > type Derived is new Formal with record > Limited_Component: T; > end record; > end; >=20 > with A; > package B is > type Actual is tagged null record; > package Instance is new A(Actual); > end; >=20 > Package B is illegal, because of something going on the private > part of A -- without Limited_Component it would be legal. > With Limited_Component, B.Instance.Derived is a nonlimited type > with a limited component, which is illegal. >=20 > I think maybe this is an indication that Ada's macro-expansion model > of generics is a wrong approach. Or it could just mean that Ada didn't provide a complete enough way for gen= erics to put conditions on the actual parameters. You can say "type T is p= rivate;", in which case the actual must be nonlimited; or you can say "type= T is limited private;", in which case the actual may be limited or nonlimi= ted. But you don't have a way to say "the actual must be limited", which i= s what would be needed here. (And similarly for "tagged"; generics don't h= ave a way to say "the actual must be untagged", and it seems that I submitt= ed an AI in the last year or two about a case where using a tagged type as = an actual for a generic formal private type led to a language hole involvin= g derived types.) -- Adam