From: Shark8 <onewingedshark@gmail.com>
Subject: Private function w/ Tagged return-type.
Date: Mon, 29 Jul 2013 13:54:40 -0700 (PDT)
Date: 2013-07-29T13:54:40-07:00 [thread overview]
Message-ID: <56e81849-4303-4a78-878c-fff8b57ce64f@googlegroups.com> (raw)
Given the following:
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);
---- private, moved here, will work.
Type Subject is tagged null record
with Input => Input;
function Create return Subject is (null record);
end example;
yields the following error message:
private function with tagged result must override visible-part function
move subprogram to the visible part (RM 3.9.3(10))
Yet, the given paragraph says:
For an abstract type declared in a visible part, an abstract primitive subprogram shall not be declared in the private part, unless it is overriding an abstract subprogram implicitly declared in the visible part. For a tagged type declared in a visible part, a primitive function with a controlling result or a controlling access result shall not be declared in the private part, unless it is overriding a function implicitly declared in the visible part.
Is the error correct? 'Input, 'Output, 'Read & 'Write are implicitly created due to the stream operations/attributes, though arguably they are not functions/subprograms.
I should think that it would be perfectly appropriate to place the declarations of the functions you're assigning to 'Read/'Write/'Input/'Output into the private portion of the package.
next reply other threads:[~2013-07-29 20:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-29 20:54 Shark8 [this message]
2013-07-29 21:20 ` Private function w/ Tagged return-type Adam Beneschan
2013-07-29 21:27 ` Adam Beneschan
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox