* Re: unconstrainded array question
1998-09-19 0:00 ` Tom Moran
@ 1998-09-19 0:00 ` dewarr
1998-09-19 0:00 ` Technobabble
1998-09-19 0:00 ` dewarr
2 siblings, 0 replies; 7+ messages in thread
From: dewarr @ 1998-09-19 0:00 UTC (permalink / raw)
In article <36033452.12702502@SantaClara01.news.InterNex.Net>,
tmoran@bix.com (Tom Moran) wrote:
> Since you gave no definition for whatever Object might be, it's a
> little hard to tell what "This.xyz" might possibly be. If xyz is an
> array, then it clearly must have bounds and it's range is defined. If
> xyz is a type, and one with indefinite bounds,
> then obviously you
> can't use those undefined bounds as if they had values.
As I often remind people, technical information that you
read on a newsgroup like this can be wrong or misleading.
This is an example.
There are no array objects in Ada with "indefinite" or
"undefined" bounds. All array objects are constrained and
have well defined bounds, so yes, of course, if the type
of Object is an array, you can use the 'Range attribute
in this case (it is indeed the primary and most familiar
use of the range attribute!)
The *type* of an array object may be unconstrained, but of
course, as in the original questioner's example, you apply
the Range attribute to the object, not the type!
Robert Dewar
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: unconstrainded array question
1998-09-19 0:00 ` Tom Moran
1998-09-19 0:00 ` dewarr
@ 1998-09-19 0:00 ` Technobabble
1998-09-19 0:00 ` dewarr
1998-09-19 0:00 ` dewarr
2 siblings, 1 reply; 7+ messages in thread
From: Technobabble @ 1998-09-19 0:00 UTC (permalink / raw)
In article <36033452.12702502@SantaClara01.news.InterNex.Net>,
tmoran@bix.com (Tom Moran) wrote:
> Since you gave no definition for whatever Object might be, it's a
> little hard to tell what "This.xyz" might possibly be. If xyz is an
> array, then it clearly must have bounds and it's range is defined. If
> xyz is a type, and one with indefinite bounds, then obviously you
> can't use those undefined bounds as if they had values.
Greetings Tom,
xyz is an unconstrained array that is declared with a discriminant to
constrain it. Since it is of type unconstrained array I just want to know
if the RANGE attribute works eg. in a loop. I guess that you are saying
YES it does since it does have bounds. The question is if I have an
unconstrained array then I can declare many objects of that type with
different ranges, so will the RANGE attribute then return different ranges
for different objects. Is this legal?
It makes sense to me that you are correct. Also, Barnes is confusing on
the subject, page 125 of second edition, last paragraph on this topic.
Richmond
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: unconstrainded array question
1998-09-19 0:00 ` Technobabble
@ 1998-09-19 0:00 ` dewarr
0 siblings, 0 replies; 7+ messages in thread
From: dewarr @ 1998-09-19 0:00 UTC (permalink / raw)
In article <WishList-1809982157000001@a17.phoenix-14.goodnet.com>,
WishList@2600.com (Technobabble) wrote:
> In article <36033452.12702502@SantaClara01.news.InterNex.Net>,
> tmoran@bix.com (Tom Moran) wrote:
>
> > Since you gave no definition for whatever Object might be, it's a
> > little hard to tell what "This.xyz" might possibly be. If xyz is an
> > array, then it clearly must have bounds and it's range is defined. If
> > xyz is a type, and one with indefinite bounds, then obviously you
> > can't use those undefined bounds as if they had values.
>
> Greetings Tom,
>
> xyz is an unconstrained array that is declared with a discriminant to
> constrain it. Since it is of type unconstrained array I just want to know
> if the RANGE attribute works eg. in a loop. I guess that you are saying
> YES it does since it does have bounds. The question is if I have an
> unconstrained array then I can declare many objects of that type with
> different ranges, so will the RANGE attribute then return different ranges
> for different objects. Is this legal?
> It makes sense to me that you are correct. Also, Barnes is confusing on
> the subject, page 125 of second edition, last paragraph on this topic.
>
> Richmond
I strongly suggest that you post COMPLETE examples. When you
are writing at a vague level and don't know the syntax of
the language precisely, let alone the semantics, it gets
VERY hard to guess what your misconceptions might be. You
will find that you get much better results if
(a) you write a complete program
(b) you compile it
(c) you try to figure out the error messages you get
(d) if you can't figure out the error messages, post the
ENTIRE (smallest possible) program that generates the
error messages, and ask.
I often find that students think they know something and so
they pose a question in a garbled form, that depends on this
knowledge, the only trouble is, the knowledge happens to be
wrong.
If you don't post a complete example, you may easily have
the phenomenon of people being confused by what you write,
and then adding to the confusion by answering something
different than what you thought you were asking.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: unconstrainded array question
1998-09-19 0:00 ` Tom Moran
1998-09-19 0:00 ` dewarr
1998-09-19 0:00 ` Technobabble
@ 1998-09-19 0:00 ` dewarr
2 siblings, 0 replies; 7+ messages in thread
From: dewarr @ 1998-09-19 0:00 UTC (permalink / raw)
In article <36033452.12702502@SantaClara01.news.InterNex.Net>,
tmoran@bix.com (Tom Moran) wrote:
> Since you gave no definition for whatever Object might be, it's a
> little hard to tell what "This.xyz" might possibly be. If xyz is an
> array, then it clearly must have bounds and it's range is defined. If
> xyz is a type, and one with indefinite bounds, then obviously you
> can't use those undefined bounds as if they had values.
Just to be a bit clearer on my response. I actually see how
Tom got confused, because the original question is indeed
itself a bit confused. But the point is that in the reference
This.xyz
we know that This is an object, so hence This.xyz is (if
legal at all) also an object, it is not possible that xyz is
a type in the example we are given (that's why Tom's response
is confusing).
Now it is true that the original example is confusing. It
is of course incomplete, and it can indeed be completed in
a correct manner, so it is not clearly wrong. However, the
best guess is that the person who posted the question is
indeed very confused (you can guess this from (a) the other
questions that the same person has asked, and (b) the odd
multiple use of the identifier xyz!)
It always amazes me how people write rather random stuff
instead of taking the effort to learn the syntax of the
language they want to write in precisely. It's like a
mathematician rummaging around trying to prove things
without first familiarizing themseles with the axioms
(and saying: well I looked at a couple of other proofs
in this area, and I have a reasonable feel for what the
axioms are likely to be :-)
>
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
^ permalink raw reply [flat|nested] 7+ messages in thread