comp.lang.ada
 help / color / mirror / Atom feed
* The 'BASE Attribute
@ 1994-11-25 10:22 "Program Validation L"
  1994-11-29  4:52 ` Tucker Taft
  0 siblings, 1 reply; 3+ messages in thread
From: "Program Validation L" @ 1994-11-25 10:22 UTC (permalink / raw)


We are confused by the meaning of the 'BASE attribute. For example, the 
LRM states that a fixed point type declaration of the form:

type T is delta D range L .. R;

is, by definition, equivalent to the following declarations:

type fixed_point_type is new predefined_fixed_point_type;
subtype T is fixed_point_type
  range fixed_point_type(L) .. fixed_point_type(R);
  
We would therefore expect T to denote the (implicitly declared) subtype, 
and T'BASE to denote the anonymous type fixed_point_type. This would mean 
that T'DELTA is valid, whilst T'BASE'DELTA is invalid, since P'DELTA is 
only defined for fixed point subtypes.

However, both the Alsys and DEC Ada compilers accept both T'DELTA and 
T'BASE'DELTA, which leads us to suppose our understanding of the LRM is 
incorrect.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: The 'BASE Attribute
@ 1994-11-26  8:34 Dave Papay M/S 7G32 x2791
  0 siblings, 0 replies; 3+ messages in thread
From: Dave Papay M/S 7G32 x2791 @ 1994-11-26  8:34 UTC (permalink / raw)


Program Validation L <pvl@CIX.COMPULINK.CO.UK> writes:

>We are confused by the meaning of the 'BASE attribute. For example, the
>LRM states that a fixed point type declaration of the form:
>
>type T is delta D range L .. R;
>
>is, by definition, equivalent to the following declarations:
>
>type fixed_point_type is new predefined_fixed_point_type;
>subtype T is fixed_point_type
>  range fixed_point_type(L) .. fixed_point_type(R);
>
>We would therefore expect T to denote the (implicitly declared) subtype,
>and T'BASE to denote the anonymous type fixed_point_type. This would mean
>that T'DELTA is valid, whilst T'BASE'DELTA is invalid, since P'DELTA is
>only defined for fixed point subtypes.

T'BASE'DELTA is legal, since in 3.3(4) the LRM states: "A type is a subtype
of itself..."

Also, although the description for the 'DELTA attribute in 3.5.10(4) states
that it "Yields the value of the delta specified in the fixed accuracy
definition for the *subtype* T" (emphasis added), 3.5.10(2) states that the
attributes listed below (which includes 'DELTA) are define "for every fixed
point *type or subtype* T" (again, emphasis added).  This paragraph also
explains why T is referred to as a subtype in some contexts, and as a type in
others.

Hope this helps.

                             |         |
David Papay                  |    o    |
papay@acm.org  (preferred)   |  ^/---  | <insert your favorite disclaimer here>
dpapay@aol.com (alternate)   |  />     |
                             |         |
                             | fleche! |



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: The 'BASE Attribute
  1994-11-25 10:22 "Program Validation L"
@ 1994-11-29  4:52 ` Tucker Taft
  0 siblings, 0 replies; 3+ messages in thread
From: Tucker Taft @ 1994-11-29  4:52 UTC (permalink / raw)


In article <CztJHx.GxE@cix.compulink.co.uk>,
Program Validation L <pvl@cix.compulink.co.uk> wrote:

>We are confused by the meaning of the 'BASE attribute. For example, the 
>LRM states that a fixed point type declaration of the form:
>
>type T is delta D range L .. R;
>
>is, by definition, equivalent to the following declarations:
>
>type fixed_point_type is new predefined_fixed_point_type;
>subtype T is fixed_point_type
>  range fixed_point_type(L) .. fixed_point_type(R);
>  
>We would therefore expect T to denote the (implicitly declared) subtype, 
>and T'BASE to denote the anonymous type fixed_point_type. This would mean 
>that T'DELTA is valid, whilst T'BASE'DELTA is invalid, since P'DELTA is 
>only defined for fixed point subtypes.

Both T and T'Base are fixed point subtypes (every type is a subtype of
itself in Ada 83).  Note that in Ada 9X, the only nameable things
are "subtypes"; "types" are anonymous abstractions.  Either way,
T'Base'Delta is legal, and equal to T'Delta in the absence of
an accuracy constraint (called a "delta constraint" in Ada 9X).

>However, both the Alsys and DEC Ada compilers accept both T'DELTA and 
>T'BASE'DELTA, which leads us to suppose our understanding of the LRM is 
>incorrect.

The compilers are correct.  In general, all type-oriented attributes are 
defined for all subtypes, including the type itself.

The general confusion between "type" and "subtype" led us to
use the term subtype uniformly in Ada 9X for things that you
can name; "type" is the underlying abstraction on which all the
subtypes are based.

-Tucker Taft   stt@inmet.com
Ada 9X Mapping/Revision Team
Intermetrics, Inc.
Cambridge, MA  02138



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1994-11-29  4:52 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-11-26  8:34 The 'BASE Attribute Dave Papay M/S 7G32 x2791
  -- strict thread matches above, loose matches on Subject: below --
1994-11-25 10:22 "Program Validation L"
1994-11-29  4:52 ` Tucker Taft

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