comp.lang.ada
 help / color / mirror / Atom feed
From: bobduff@world.std.com (Robert A Duff)
Subject: Re: Question about record rep spec placement
Date: 1997/01/18
Date: 1997-01-18T00:00:00+00:00	[thread overview]
Message-ID: <E47s35.59o@world.std.com> (raw)
In-Reply-To: 32E02DB1.6E06@lmtas.lmco.com


In article <32E02DB1.6E06@lmtas.lmco.com>,
Ken Garlington  <GarlingtonKE@lmtas.lmco.com> wrote:
>I guess this depends upon whether being unable to put the rep spec in
>the private area due to freezing rules is a "pathological" case (as has
>been described previously) or will occur relatively often. If the
>former,
>then a comment should do for those cases where the rep spec can't be
>placed in the private area. If the latter, then I think this potential
>incompatibility from Ada83 to Ada should be more widely advertised.

I think you misunderstood what somebody said about "pathological".
The upward incompatibilities are pathological, I believe.
However, there are violations of the freezing rules that are not
pathological, but these are not upward incompatibilities, since
they existed in Ada 83.  By and large, the Ada 95 rules are *more*
permissive than the Ada 83 rules.

Here's a violation:

    package P is
        type Point is
            record
                X, Y: Integer;
            end record;
        Origin: constant Point := (0, 0);
    private
        for Point use -- Illegal.
            record
                ...
            end record;
    end P;

The above is illegal in both Ada 83 and Ada 95.  But declaring a
constant is a perfectly reasonable thing to do.  Another example
is passing a type to a generic instantiation -- perfectly reasonable,
and prevents later rep clauses.

Here's an example of an upward incompatility:

    package P is
        type R is
            record
                X: Integer;
            end record;
        task T is
            pragma Priority(X'Size);
        end T;
    private
        for R'Size use 32; -- Illegal in Ada 95.
    end P;

The above is legal in Ada 83, and the pragma is IGNORED!  This seems
pretty pathological to me.

Here's an example where the rules are more permissive:

    package P is
        type T is private;
        
        generic
            X: T; -- Illegal in Ada 83, now legal in Ada 95.
        package G is
            ...
        end G;

    private
	type T is ...;
    end P;

The above seems like a pretty reasonable thing to do.

>I don't know which is the case; does anyone has real-world experience
>they
>could share?

It's happened to me more than once.  But it doesn't happen a LOT.

- Bob




  reply	other threads:[~1997-01-18  0:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-15  0:00 Question about record rep spec placement Ken Garlington
1997-01-15  0:00 ` Bob Gilbert
1997-01-16  0:00   ` Fergus Henderson
1997-01-17  0:00   ` Ken Garlington
1997-01-17  0:00     ` Bob Gilbert
1997-01-17  0:00       ` Robert A Duff
1997-01-17  0:00         ` Ken Garlington
1997-01-18  0:00           ` Robert A Duff [this message]
1997-01-18  0:00             ` Ken Garlington
1997-01-19  0:00               ` Robert A Duff
1997-01-21  0:00         ` Bob Gilbert
1997-01-22  0:00           ` Ken Garlington
1997-01-23  0:00             ` Art Schwarz
1997-01-25  0:00               ` Ken Garlington
1997-01-24  0:00             ` Bob Gilbert
1997-01-25  0:00               ` Ken Garlington
1997-01-20  0:00       ` Ken Garlington
1997-01-15  0:00 ` Norman H. Cohen
1997-01-16  0:00   ` Ken Garlington
1997-01-17  0:00     ` Robert A Duff
1997-01-18  0:00       ` Ken Garlington
1997-01-16  0:00 ` Jeff Creem
1997-01-16  0:00 ` Jerome Desquilbet
replies disabled

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