TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

Use Monospaced Font
Show HTML Part by Default
Condense Mail Headers

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

Print Reply
Sender: "Team Ada: Ada Programming Language Advocacy (83 & 95)" <[log in to unmask]>
Date: Sun, 19 Dec 2004 18:27:03 -0600
Reply-To: Jeffrey Carter <[log in to unmask]>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
In-Reply-To: <[log in to unmask]>
Content-Type: text/plain; charset=us-ascii; format=flowed
From: Jeffrey Carter <[log in to unmask]>
Parts/Attachments: 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
76

ATOM RSS1 RSS2