TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Jeffrey Carter <[log in to unmask]>
Reply To:
Jeffrey Carter <[log in to unmask]>
Sun, 19 Dec 2004 18:27:03 -0600
text/plain (43 lines)
[log in to unmask] wrote:

>    1)  A type definition
>    2)   Two derivired types from the first
>    3)   A rep-spec for each of the derived types
>    4)   Two instantians of ENUMERATION_IO.
>    5)    One assigment statement to up-convert and then down-covert.
> and you hvae your program.

If I understand correctly, you're talking about converting something like

type T1 is (A, B, C);
for T1 use (A => 1, B => 2, C => 4);

into something like

type T2 is (A, B, C);
for T2 use (A =>1, B => 3, C => 7);

In that case, it's even easier than you said:

type T1 is (A, B, C);
for T1 use (A => 1, B => 2, C => 4);

type T2 is new T1;
for T2 use (A =>1, B => 3, C => 7);

V : T1;


Get (V);
Put (T2 (V) );

Jeff Carter
"I was hobbling along, minding my own business, all of a
sudden, up he comes, cures me! One minute I'm a leper with
a trade, next minute my livelihood's gone! Not so much as a
'by your leave!' You're cured, mate. Bloody do-gooder!"
Monty Python's Life of Brian