comp.lang.ada
 help / color / mirror / Atom feed
* Ada type question
@ 1989-01-06 15:09 Keith Shillington @prodigal
  1989-01-07 16:28 ` Mike Packer,318K,,2928607
  0 siblings, 1 reply; 2+ messages in thread
From: Keith Shillington @prodigal @ 1989-01-06 15:09 UTC (permalink / raw)



-- To define an array type:

type x is array(integer range 1..10) of character;

-- Would define a ten element array of characters.  "Better" Ada would be:

subtype x_range is integer range 1..10;
type x is array(x_range) of character;

-- More flexible would be:

type x is array(integer range <>) of character;

subtype working_x_range is integer range 1..10;
subtype large_x_range is integer range 0..1000;

subtype working_x is x(working_x_range);
subtype large_x   is x(large_x_range);

-- Then you can define your index variables of an appropriate type to work
-- with the objects that you define of the various x subtypes.

-- Keith Shillington, Education Group, TeleSoft

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

* Re: Ada type question
  1989-01-06 15:09 Ada type question Keith Shillington @prodigal
@ 1989-01-07 16:28 ` Mike Packer,318K,,2928607
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Packer,318K,,2928607 @ 1989-01-07 16:28 UTC (permalink / raw)


I posted a question here a few days ago about Ada TYPEs, but it seems
many people didn't understand the actual problem I was having.
I have since then found the answer that I needed (but not wanted)

what I originally asked was (is there any way to do this)

make a type definition that looks something like this:

type X is (array, .....)

i was not trying to define something of an array.  What I wanted
was a new type "X" that could take on a value "array" or whatever
else is in the list. But the problem was that array is a keyword
(reserved) therefore I couldn't do what I wanted, the only alternative
that I have been able to come up with is:

defining X as an array of string
x(1):= "array     "
x(2):= "whatever  "
.
.
.

Thanks for all of the responses!

Just thought I would clear up some of the confusion to my original 
question
Michael Packer
USMAIL:	318 Knapp Hall, WVU, Morgantown, WV 26506
PHONE:	304 293-3607
INTERNET : packer@a.cs.wvu.wvnet.edu
USENET:  {allegra,bellcore,ihpn4!cadre,decvax!idis,psuvax1}!pitt!wvucsa!packer

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

end of thread, other threads:[~1989-01-07 16:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1989-01-06 15:09 Ada type question Keith Shillington @prodigal
1989-01-07 16:28 ` Mike Packer,318K,,2928607

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