comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@world.std.com>
Subject: Re: use of attribute Pos
Date: 2000/10/12
Date: 2000-10-12T00:00:00+00:00	[thread overview]
Message-ID: <wccvguy58if.fsf@world.std.com> (raw)
In-Reply-To: 39E583F7.A971C8DB@laas.fr

Philippe Torres <ptorres@laas.fr> writes:

> type Upper is new Character range 'A'..'Z' ;

> Since a different type is introduced, how does Pos still refer to
> Character ?

Because the *type* contains all those 256 characters.
The above is essentially equivalent to:

    type Mumble is new Character;
    subtype Upper is Mumble range 'A'..'Z';

So, for example, you could say:

    X: Upper'Base := '+'; -- Upper'Base is the base (unconstrained) subtype.
    Y: Upper := Upper'Succ('@'); -- Initializes Y to 'A'.

In other words, '+' and '@' are values of the type, even though Upper is
constrained not to include them.

- Bob




  reply	other threads:[~2000-10-12  0:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-11  0:00 use of attribute Pos Philippe Torres
2000-10-11  0:00 ` Jerry Petrey
2000-10-11  0:00   ` Ehud Lamm
     [not found] ` <39E4A637.AE6EE630@cepsz.unizar.es>
2000-10-11  0:00   ` Jerry Petrey
2000-10-14  3:32   ` Robert Dewar
2000-10-16  0:00     ` Alejandro Villanueva
2000-10-16  0:00       ` Ken Garlington
2000-10-18  0:00         ` Alejandro Villanueva
2000-10-16  0:00       ` Robert Dewar
2000-10-18  0:00         ` Alejandro Villanueva
2000-10-11  0:00 ` Pat Rogers
2000-10-12  0:00   ` Philippe Torres
2000-10-12  0:00     ` Robert A Duff [this message]
2000-10-12  0:00     ` Pat Rogers
2000-10-12  0:00       ` Philippe Torres
2000-10-12  0:00         ` Pat Rogers
2000-10-12  0:00           ` Tucker Taft
2000-10-12  0:00             ` Philippe Torres
2000-10-12  0:00               ` Ehud Lamm
2000-10-12  0:00             ` Ehud Lamm
2000-10-12  0:00               ` Pat Rogers
2000-10-12  0:00               ` Philippe Torres
2000-10-12  0:00         ` mark.biggar
replies disabled

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