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.224.169.1 with SMTP id w1mr38264470qay.4.1375132824797; Mon, 29 Jul 2013 14:20:24 -0700 (PDT) X-Received: by 10.50.124.66 with SMTP id mg2mr579062igb.16.1375132824752; Mon, 29 Jul 2013 14:20:24 -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!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!cb17no1052679qab.0!news-out.google.com!ij2ni119qab.0!nntp.google.com!cb17no11676qab.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 29 Jul 2013 14:20:24 -0700 (PDT) In-Reply-To: <56e81849-4303-4a78-878c-fff8b57ce64f@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=66.126.103.122; posting-account=RxNzCgoAAACA5KmgtFQuaU-WaH7rjnAO NNTP-Posting-Host: 66.126.103.122 References: <56e81849-4303-4a78-878c-fff8b57ce64f@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <64498c9c-7add-4b4e-a592-51e12e1aeba6@googlegroups.com> Subject: Re: Private function w/ Tagged return-type. From: Adam Beneschan Injection-Date: Mon, 29 Jul 2013 21:20:24 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: news.eternal-september.org comp.lang.ada:16603 Date: 2013-07-29T14:20:24-07:00 List-Id: On Monday, July 29, 2013 1:54:40 PM UTC-7, Shark8 wrote: > Given the following: >=20 >=20 >=20 > with Ada.Streams; > package example is > Type Subject is tagged private; > function Create return Subject; > private > function Input( > Stream : not null access Ada.Streams.Root_Stream_Type'Class) > return Subject is (Create); >=20 > ---- private, moved here, will work. >=20 > Type Subject is tagged null record > with Input =3D> Input; >=20 > function Create return Subject is (null record); > end example; >=20 > yields the following error message: >=20 > private function with tagged result must override visible-part funct= ion > move subprogram to the visible part (RM 3.9.3(10)) >=20 > Yet, the given paragraph says: >=20 > For an abstract type declared in a visible part, an abstract primitive= subprogram shall not be declared in the private part, unless it is overrid= ing an abstract subprogram implicitly declared in the visible part. For a t= agged type declared in a visible part, a primitive function with a controll= ing result or a controlling access result shall not be declared in the priv= ate part, unless it is overriding a function implicitly declared in the vis= ible part. >=20 > Is the error correct? 'Input, 'Output, 'Read & 'Write are implicitly crea= ted due to the stream operations/attributes, though arguably they are not f= unctions/subprograms. Well, no matter which way you argue, the T'Input function does not have the= name "Input" and will not be overridden by a function named "Input". You can put your Input function in a nested package to avoid the error, sin= ce that will make it non-primitive. -- Adam