comp.lang.ada
 help / color / mirror / Atom feed
* Derived private type in Ada 9X
@ 1988-03-04 15:45 stt
  0 siblings, 0 replies; only message in thread
From: stt @ 1988-03-04 15:45 UTC (permalink / raw)



Here's another gripe for the Ada 9X effort:

It is quite annoying that private types with
discriminants may not be defined as derived types,
where the parent type has matching or conforming
discriminants.

For example, the following is currently illegal, due to
7.4.1:3 -- "If a private type declaration includes a discriminant
part, the full declaration must include a discriminant part that
conforms . . . and its type definition must be a record type
definition."

package Public_Pkg is
    type Public_Rec(D : Boolean := True) is record
        case D is
            when True => X : Integer;
            when False => Y : Float;
        end case;
    end record;
end Public_Pkg;

with Public_Pkg;
package Private_Pkg is
    type Private_Rec(D : Boolean := True) is private;
private
    type Private_Rec is new Public_Pkg.Public_Rec;
end Private_Pkg;

Here is some alternate wording which would allow this situation:

"If a private type includes a discriminant, the full
declaration must include a discriminant part..., or
must be a derived type definition where the parent
type is a type with discriminants whose definition
conforms."

Tucker Taft
c/o Intermetrics
Cambridge, MA  02138

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1988-03-04 15:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1988-03-04 15:45 Derived private type in Ada 9X stt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox