comp.lang.ada
 help / color / mirror / Atom feed
* Re: use of attribute Pos
  2000-10-11  0:00 use of attribute Pos Philippe Torres
@ 2000-10-11  0:00 ` Pat Rogers
  2000-10-12  0:00   ` Philippe Torres
  2000-10-11  0:00 ` Jerry Petrey
       [not found] ` <39E4A637.AE6EE630@cepsz.unizar.es>
  2 siblings, 1 reply; 23+ messages in thread
From: Pat Rogers @ 2000-10-11  0:00 UTC (permalink / raw)


"Philippe Torres" <ptorres@laas.fr> wrote in message
news:39E4A08D.B454CB1C@laas.fr...
> Hi, do you think the following behaviour is normal ?
> -----
> subtype Upper is character range 'A'..'Z' ;
> begin
> Put(Upper'Pos('A')) ;
> -----
> Output : 65
>
> I was expecting 0 since 'A' is the first element of Upper but i got
> the ranking of 'A' in the Character type.
>
> What's the point of defining constrained subtype if we can't use the
> attributes on it ? Or am i missing something ?

A subtype does not introduce a new type -- it names a constraint on an
existing type.  Understand that and all else follows.

You can indeed use the attributes on the subtype, but you must
recognize that only those attributes that represent *constraints* will
be different than those of the actual type in question.  Thus
Upper'first will yield 'A', Upper'last will yield 'Z', and so on.

Its all in the "names for constraints" concept...

---
Patrick Rogers                      Consulting and Training in:
http://www.classwide.com      Deadline Schedulability Analysis
progers@classwide.com        Software Fault Tolerance
(281)648-3165                       Real-Time/OO Languages

Adam ... does not deserve all the credit; much is due to Eve, the
first woman, and Satan, the first consultant.
Mark Twain






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

* Re: use of attribute Pos
       [not found] ` <39E4A637.AE6EE630@cepsz.unizar.es>
@ 2000-10-11  0:00   ` Jerry Petrey
  2000-10-14  3:32   ` Robert Dewar
  1 sibling, 0 replies; 23+ messages in thread
From: Jerry Petrey @ 2000-10-11  0:00 UTC (permalink / raw)




Alejandro Villanueva wrote:
> 
> Philippe Torres wrote:
> 
> > Hi, do you think the following behaviour is normal ?
> > -----
> > subtype Upper is character range 'A'..'Z' ;
> > begin
> > Put(Upper'Pos('A')) ;
> > -----
> > Output : 65
> >
> > I was expecting 0 since 'A' is the first element of Upper but i got
> > the ranking of 'A' in the Character type.
> >
> 
> Then you should have done this:
> -----
> type Upper is new Character range 'A' .. 'Z';
> begin
> Put (Upper'Pos ('A'));
> end;
> -----
> Output: 1


Actually this will also return the position in the base type Character
or 65.



> >
> > What's the point of defining constrained subtype if we can't use the
> >
> > attributes on it ? Or am i missing something ?
> >
> 
> If you use the subtype then the correct code would be:
> -----
> Put (Upper'Pos ('X') - Upper'Pos (Upper'First));
> 
> 

The above is the correct way to get what Philippe expected (with the X
being replaced by A)
since 'First does not apply to the base type.

Jerry
-- 
-----------------------------------------------------------------------------
-- Jerry Petrey                                                
-- Senior Principal Systems Engineer - Member Team Ada & Team Forth
-- Raytheon Missile Systems 
-- NOTE: please remove NOSPAM in email address to reply                  
-----------------------------------------------------------------------------




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

* Re: use of attribute Pos
  2000-10-11  0:00 use of attribute Pos Philippe Torres
  2000-10-11  0:00 ` Pat Rogers
@ 2000-10-11  0:00 ` Jerry Petrey
  2000-10-11  0:00   ` Ehud Lamm
       [not found] ` <39E4A637.AE6EE630@cepsz.unizar.es>
  2 siblings, 1 reply; 23+ messages in thread
From: Jerry Petrey @ 2000-10-11  0:00 UTC (permalink / raw)




Philippe Torres wrote:
> 
> Hi, do you think the following behaviour is normal ?
> -----
> subtype Upper is character range 'A'..'Z' ;
> begin
> Put(Upper'Pos('A')) ;
> -----
> Output : 65
> 
> I was expecting 0 since 'A' is the first element of Upper but i got
> the ranking of 'A' in the Character type.
> 
> What's the point of defining constrained subtype if we can't use the
> attributes on it ? Or am i missing something ?
> 
> I use gnatmake to compile.
> 
> Philippe


'Pos will give you the position in the "base" type which is Character
and
thus 65 is correct.

Jerry


-- 
-----------------------------------------------------------------------------
-- Jerry Petrey                                                
-- Senior Principal Systems Engineer - Member Team Ada & Team Forth
-- Raytheon Missile Systems 
-- NOTE: please remove NOSPAM in email address to reply                  
-----------------------------------------------------------------------------




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

* use of attribute Pos
@ 2000-10-11  0:00 Philippe Torres
  2000-10-11  0:00 ` Pat Rogers
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Philippe Torres @ 2000-10-11  0:00 UTC (permalink / raw)


Hi, do you think the following behaviour is normal ?
-----
subtype Upper is character range 'A'..'Z' ;
begin
Put(Upper'Pos('A')) ;
-----
Output : 65 

I was expecting 0 since 'A' is the first element of Upper but i got
the ranking of 'A' in the Character type.

What's the point of defining constrained subtype if we can't use the
attributes on it ? Or am i missing something ?

I use gnatmake to compile.

Philippe




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

* Re: use of attribute Pos
  2000-10-11  0:00 ` Jerry Petrey
@ 2000-10-11  0:00   ` Ehud Lamm
  0 siblings, 0 replies; 23+ messages in thread
From: Ehud Lamm @ 2000-10-11  0:00 UTC (permalink / raw)


> 'Pos will give you the position in the "base" type which is Character
> and
> thus 65 is correct.
>
> Jerry


Let's hear it once more for Annex K.

Ehud Lamm   mslamm@mscc.huji.ac.il
http://purl.oclc.org/NET/ehudlamm <==  Me!










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

* Re: use of attribute Pos
  2000-10-12  0:00   ` Philippe Torres
  2000-10-12  0:00     ` Robert A Duff
@ 2000-10-12  0:00     ` Pat Rogers
  2000-10-12  0:00       ` Philippe Torres
  1 sibling, 1 reply; 23+ messages in thread
From: Pat Rogers @ 2000-10-12  0:00 UTC (permalink / raw)


"Philippe Torres" <ptorres@laas.fr> wrote in message
news:39E583F7.A971C8DB@laas.fr...
<snip>
> OK. Thank you all for your answers.
> I understand the behaviour on a subtype of "constraint" attributes
are
> the sole to change compared to the base class.
> But now, i wonder why Alejandro's solution
> ----
> type Upper is new Character range 'A'..'Z' ;
> begin
> Put(Upper'Pos('A')) ;
> ---
> still manages to output 65 and not 0.
>
> Since a different type is introduced, how does Pos still refer to
> Character ?
> Should not 'new' have broken all "links" between the types Character
and
> Upper ?

Now things get a little bit more involved.  :-)   The terminology
invariably confuses people, so I won't be precise in that regard.
Let's just say that what you really have here is a subtype of a type
derived from Character.  Since it has a distinct name (Upper) it is a
distinct type, but it is still a constraint on Character.

Hope that helps, as opposed to making it worse!  :-)

---
Patrick Rogers                      Consulting and Training in:
http://www.classwide.com      Deadline Schedulability Analysis
progers@classwide.com        Software Fault Tolerance
(281)648-3165                       Real-Time/OO Languages

Adam ... does not deserve all the credit; much is due to Eve, the
first woman, and Satan, the first consultant.
Mark Twain






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

* Re: use of attribute Pos
  2000-10-12  0:00       ` Philippe Torres
  2000-10-12  0:00         ` Pat Rogers
@ 2000-10-12  0:00         ` mark.biggar
  1 sibling, 0 replies; 23+ messages in thread
From: mark.biggar @ 2000-10-12  0:00 UTC (permalink / raw)


In article <39E5DE79.F61616EC@laas.fr>,
  Philippe Torres <ptorres@laas.fr> wrote:
> Pat Rogers wrote:
> >
> > "Philippe Torres" <ptorres@laas.fr> wrote in message
> > > But now, i wonder why Alejandro's solution
> > > ----
> > > type Upper is new Character range 'A'..'Z' ;
> > > begin
> > > Put(Upper'Pos('A')) ;
> > > ---
> > > still manages to output 65 and not 0.
> > >
> > > Since a different type is introduced, how does Pos still refer to
> > > Character ?
> > > Should not 'new' have broken all "links" between the types
Character
> > and
> > > Upper ?
> >
> > Now things get a little bit more involved.  :-)   The terminology
> > invariably confuses people, so I won't be precise in that regard.
> > Let's just say that what you really have here is a subtype of a type
> > derived from Character.  Since it has a distinct name (Upper) it is
a
> > distinct type, but it is still a constraint on Character.
> >
> > Hope that helps, as opposed to making it worse!  :-)
> >
>
> OK but to me it would have been more logical to have the attribute Pos
> reflecting exactly the position of the element in the range of the
type
> which has been "ticked".
> Anyway thanks for your help but it's a bit misleading for a newbie
like
> me to guess which are the attributes "overloaded" by a subtype or a
> derived type and which are merely "inherited such as" from the base
> type.

Except thast it is reflecting the type being ticked.  In Ada there
are no named types; only subtypes have names.  So the type
declaration:

type upper is new character range 'A'..'Z';

is really equavalent to:

type <anon> is new character;
subtype upper is <anon> range 'A'..'Z';

so the real underlying type looks just like the type character
and thus upper'pos('A') is still 65.

Note that the underlying type can be exposed using upper'base
which look jsut like character.

If you really wanted a type that worked the way you expected then
you must declare a completely new character type like:

type upper is ('A','B','C', ... ,'Z');

but now there is no relationship at all between character'('A')
and upper'('A'), just like ther is no real realtion between two
emumeration type values from different emumeration types that just
happen to share the same identifer.

--
mark.biggar@trustedsyslabs.com


Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: use of attribute Pos
  2000-10-12  0:00   ` Philippe Torres
@ 2000-10-12  0:00     ` Robert A Duff
  2000-10-12  0:00     ` Pat Rogers
  1 sibling, 0 replies; 23+ messages in thread
From: Robert A Duff @ 2000-10-12  0:00 UTC (permalink / raw)


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




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

* Re: use of attribute Pos
  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         ` mark.biggar
  1 sibling, 1 reply; 23+ messages in thread
From: Pat Rogers @ 2000-10-12  0:00 UTC (permalink / raw)


"Philippe Torres" <ptorres@laas.fr> wrote in message
news:39E5DE79.F61616EC@laas.fr...
> Pat Rogers wrote:
> >
> > "Philippe Torres" <ptorres@laas.fr> wrote in message
> > > But now, i wonder why Alejandro's solution
> > > ----
> > > type Upper is new Character range 'A'..'Z' ;
> > > begin
> > > Put(Upper'Pos('A')) ;
> > > ---
> > > still manages to output 65 and not 0.
> > >
> > > Since a different type is introduced, how does Pos still refer
to
> > > Character ?
> > > Should not 'new' have broken all "links" between the types
Character
> > and
> > > Upper ?
> >
> > Now things get a little bit more involved.  :-)   The terminology
> > invariably confuses people, so I won't be precise in that regard.
> > Let's just say that what you really have here is a subtype of a
type
> > derived from Character.  Since it has a distinct name (Upper) it
is a
> > distinct type, but it is still a constraint on Character.
> >
> > Hope that helps, as opposed to making it worse!  :-)
> >
>
> OK but to me it would have been more logical to have the attribute
Pos
> reflecting exactly the position of the element in the range of the
type
> which has been "ticked".
> Anyway thanks for your help but it's a bit misleading for a newbie
like
> me to guess which are the attributes "overloaded" by a subtype or a
> derived type and which are merely "inherited such as" from the base
> type.

Instead of

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

imagine you wrote it this way:

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

That's effectively what you've got.   Anonymous'Pos('A') would be 65,
and thus so is Upper'Pos('A')

Better?

---
Patrick Rogers                      Consulting and Training in:
http://www.classwide.com      Deadline Schedulability Analysis
progers@classwide.com        Software Fault Tolerance
(281)648-3165                       Real-Time/OO Languages

Adam ... does not deserve all the credit; much is due to Eve, the
first woman, and Satan, the first consultant.
Mark Twain






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

* Re: use of attribute Pos
  2000-10-12  0:00             ` Ehud Lamm
  2000-10-12  0:00               ` Philippe Torres
@ 2000-10-12  0:00               ` Pat Rogers
  1 sibling, 0 replies; 23+ messages in thread
From: Pat Rogers @ 2000-10-12  0:00 UTC (permalink / raw)


Too much info!  When somebody is new and confused we shouldn't drown
them in the details!  :-)


"Ehud Lamm" <mslamm@mscc.huji.ac.il> wrote in message
news:8s4v1s$1gj$1@news.huji.ac.il...
>
> Tucker Taft <stt@averstar.com> wrote in message
>  > Some attributes are type-related, and others are
> > subtype-specific.  'First and 'Last are subtype-specific,
> > whereas 'Pos, 'Image, (and all the attributes that are
> > functions) are type-related.
> >
>
> To make things even more intersting for first time users of the
language, an
> attribute can mean sometinhg different when applied to a TYPE and to
> VARIABLE.
> V'frist means something different than T'first (V=VAR, T=TYPE).
>
>
> --
> Ehud Lamm   mslamm@mscc.huji.ac.il
> http://purl.oclc.org/NET/ehudlamm <==  Me!
>
>
>
>
>
>






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

* Re: use of attribute Pos
  2000-10-11  0:00 ` Pat Rogers
@ 2000-10-12  0:00   ` Philippe Torres
  2000-10-12  0:00     ` Robert A Duff
  2000-10-12  0:00     ` Pat Rogers
  0 siblings, 2 replies; 23+ messages in thread
From: Philippe Torres @ 2000-10-12  0:00 UTC (permalink / raw)


Pat Rogers wrote:
> 
> "Philippe Torres" <ptorres@laas.fr> wrote in message
> news:39E4A08D.B454CB1C@laas.fr...
> > Hi, do you think the following behaviour is normal ?
> > -----
> > subtype Upper is character range 'A'..'Z' ;
> > begin
> > Put(Upper'Pos('A')) ;
> > -----
> > Output : 65
> >
> > I was expecting 0 since 'A' is the first element of Upper but i got
> > the ranking of 'A' in the Character type.
> >
> > What's the point of defining constrained subtype if we can't use the
> > attributes on it ? Or am i missing something ?
> 
> A subtype does not introduce a new type -- it names a constraint on an
> existing type.  Understand that and all else follows.
> 
> You can indeed use the attributes on the subtype, but you must
> recognize that only those attributes that represent *constraints* will
> be different than those of the actual type in question.  Thus
> Upper'first will yield 'A', Upper'last will yield 'Z', and so on.
> 
> Its all in the "names for constraints" concept...
> 
OK. Thank you all for your answers.
I understand the behaviour on a subtype of "constraint" attributes are
the sole to change compared to the base class.
But now, i wonder why Alejandro's solution
----
type Upper is new Character range 'A'..'Z' ;
begin
Put(Upper'Pos('A')) ;
---
still manages to output 65 and not 0.

Since a different type is introduced, how does Pos still refer to
Character ?
Should not 'new' have broken all "links" between the types Character and
Upper ?

Philippe




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

* Re: use of attribute Pos
  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         ` mark.biggar
  0 siblings, 2 replies; 23+ messages in thread
From: Philippe Torres @ 2000-10-12  0:00 UTC (permalink / raw)


Pat Rogers wrote:
> 
> "Philippe Torres" <ptorres@laas.fr> wrote in message
> > But now, i wonder why Alejandro's solution
> > ----
> > type Upper is new Character range 'A'..'Z' ;
> > begin
> > Put(Upper'Pos('A')) ;
> > ---
> > still manages to output 65 and not 0.
> >
> > Since a different type is introduced, how does Pos still refer to
> > Character ?
> > Should not 'new' have broken all "links" between the types Character
> and
> > Upper ?
> 
> Now things get a little bit more involved.  :-)   The terminology
> invariably confuses people, so I won't be precise in that regard.
> Let's just say that what you really have here is a subtype of a type
> derived from Character.  Since it has a distinct name (Upper) it is a
> distinct type, but it is still a constraint on Character.
> 
> Hope that helps, as opposed to making it worse!  :-)
> 

OK but to me it would have been more logical to have the attribute Pos
reflecting exactly the position of the element in the range of the type
which has been "ticked".
Anyway thanks for your help but it's a bit misleading for a newbie like
me to guess which are the attributes "overloaded" by a subtype or a
derived type and which are merely "inherited such as" from the base
type.

Philippe




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

* Re: use of attribute Pos
  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
  0 siblings, 2 replies; 23+ messages in thread
From: Tucker Taft @ 2000-10-12  0:00 UTC (permalink / raw)


Pat Rogers wrote:
> 
> "Philippe Torres" <ptorres@laas.fr> wrote in message
> news:39E5DE79.F61616EC@laas.fr...
> > Pat Rogers wrote:
> > >
> > > "Philippe Torres" <ptorres@laas.fr> wrote in message
> > > > But now, i wonder why Alejandro's solution
> > > > ----
> > > > type Upper is new Character range 'A'..'Z' ;
> > > > begin
> > > > Put(Upper'Pos('A')) ;
> > > > ---
> > > > still manages to output 65 and not 0.
> > > >
> > > > Since a different type is introduced, how does Pos still refer
> to
> > > > Character ?
> > > > Should not 'new' have broken all "links" between the types
> Character
> > > and
> > > > Upper ?
> > >
> > > Now things get a little bit more involved.  :-)   The terminology
> > > invariably confuses people, so I won't be precise in that regard.
> > > Let's just say that what you really have here is a subtype of a
> type
> > > derived from Character.  Since it has a distinct name (Upper) it
> is a
> > > distinct type, but it is still a constraint on Character.
> > >
> > > Hope that helps, as opposed to making it worse!  :-)
> > >
> >
> > OK but to me it would have been more logical to have the attribute
> Pos
> > reflecting exactly the position of the element in the range of the
> type
> > which has been "ticked".
> > Anyway thanks for your help but it's a bit misleading for a newbie
> like
> > me to guess which are the attributes "overloaded" by a subtype or a
> > derived type and which are merely "inherited such as" from the base
> > type.
> 
> Instead of
> 
>     type Upper is new Character range 'A'..'Z' ;
> 
> imagine you wrote it this way:
> 
>     type Anonymous is new Character;
>     subtype Upper is Anonymous range 'A' .. 'Z';
> 
> That's effectively what you've got.   Anonymous'Pos('A') would be 65,
> and thus so is Upper'Pos('A')

You can actually get at this "underlying" unconstrained
(sub)type, by using the 'Base attribute.

Hence, Upper'Base'First equals nul.

Some attributes are type-related, and others are
subtype-specific.  'First and 'Last are subtype-specific,
whereas 'Pos, 'Image, (and all the attributes that are
functions) are type-related.

> 
> Better?
> 
> ---
> Patrick Rogers                      Consulting and Training in:
> http://www.classwide.com      Deadline Schedulability Analysis
> progers@classwide.com        Software Fault Tolerance
> (281)648-3165                       Real-Time/OO Languages

-- 
-Tucker Taft   stt@averstar.com   http://www.averstar.com/~stt/
Technical Director, Commercial Division, AverStar (formerly Intermetrics)
(http://www.averstar.com/services/IT_consulting.html)  Burlington, MA  USA




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

* Re: use of attribute Pos
  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               ` Philippe Torres
  2000-10-12  0:00               ` Pat Rogers
  1 sibling, 2 replies; 23+ messages in thread
From: Ehud Lamm @ 2000-10-12  0:00 UTC (permalink / raw)



Tucker Taft <stt@averstar.com> wrote in message
 > Some attributes are type-related, and others are
> subtype-specific.  'First and 'Last are subtype-specific,
> whereas 'Pos, 'Image, (and all the attributes that are
> functions) are type-related.
>

To make things even more intersting for first time users of the language, an
attribute can mean sometinhg different when applied to a TYPE and to
VARIABLE.
V'frist means something different than T'first (V=VAR, T=TYPE).


--
Ehud Lamm   mslamm@mscc.huji.ac.il
http://purl.oclc.org/NET/ehudlamm <==  Me!









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

* Re: use of attribute Pos
  2000-10-12  0:00             ` Ehud Lamm
@ 2000-10-12  0:00               ` Philippe Torres
  2000-10-12  0:00               ` Pat Rogers
  1 sibling, 0 replies; 23+ messages in thread
From: Philippe Torres @ 2000-10-12  0:00 UTC (permalink / raw)


Ehud Lamm wrote:
> 
> Tucker Taft <stt@averstar.com> wrote in message
>  > Some attributes are type-related, and others are
> > subtype-specific.  'First and 'Last are subtype-specific,
> > whereas 'Pos, 'Image, (and all the attributes that are
> > functions) are type-related.
> >
> 
> To make things even more intersting for first time users of the language, an
> attribute can mean sometinhg different when applied to a TYPE and to
> VARIABLE.
> V'frist means something different than T'first (V=VAR, T=TYPE).
> 

I found a very useful reference card which sums up all the attributes
for subtypes, tasks, records, objects,... 
and to avoid confusions the 2 cases are separated :

(discriminated type or array)'First : Lower bound of first index of
[constrained] 				      				      array type

(subtype)'First : Lower bound of the range of scalar subtype

All in all, almost 100 attributes and/or using conditions are listed. I
guess they are very useful when you are accustomed to them but i'm in
quite a fight right now.

Thanks to all of you for your time and to pukite@diana.com for that
card.

Philippe




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

* Re: use of attribute Pos
  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
  1 sibling, 1 reply; 23+ messages in thread
From: Philippe Torres @ 2000-10-12  0:00 UTC (permalink / raw)


Tucker Taft wrote:
> 
> Some attributes are type-related, and others are
> subtype-specific.  'First and 'Last are subtype-specific,
> whereas 'Pos, 'Image, (and all the attributes that are
> functions) are type-related.
> 
I got them all learnt with base class examples so i could not guess
about that "particular" feature. Bah, learning the hard way is the best
to really understand. Shame for the time needed though.

Philippe




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

* Re: use of attribute Pos
  2000-10-12  0:00             ` Philippe Torres
@ 2000-10-12  0:00               ` Ehud Lamm
  0 siblings, 0 replies; 23+ messages in thread
From: Ehud Lamm @ 2000-10-12  0:00 UTC (permalink / raw)



I am a great fan of attributes and Annex K. In fact (call me strange!) I
like toreread it every once in a while.  Grasping what they do is usually
pretty simple, and they  are great tools.

Enjoy Ada!

--
Ehud Lamm   mslamm@mscc.huji.ac.il
http://purl.oclc.org/NET/ehudlamm <==  Me!



Philippe Torres <ptorres@laas.fr> wrote in message
news:39E60ABD.7E8DBB1C@laas.fr...
> Tucker Taft wrote:
> >
> > Some attributes are type-related, and others are
> > subtype-specific.  'First and 'Last are subtype-specific,
> > whereas 'Pos, 'Image, (and all the attributes that are
> > functions) are type-related.
> >
> I got them all learnt with base class examples so i could not guess
> about that "particular" feature. Bah, learning the hard way is the best
> to really understand. Shame for the time needed though.
>
> Philippe






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

* Re: use of attribute Pos
       [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
  1 sibling, 1 reply; 23+ messages in thread
From: Robert Dewar @ 2000-10-14  3:32 UTC (permalink / raw)


In article <39E4A637.AE6EE630@cepsz.unizar.es>,
  Alejandro Villanueva <190921@cepsz.unizar.es> wrote:
> Then you should have done this:
> -----
> type Upper is new Character range 'A' .. 'Z';
> begin
> Put (Upper'Pos ('A'));
> end;
> -----
> Output: 1

Please test out examples before you post them, it avoids
quite a lot of cases of blatant misinformation of this
type.

Also, please do NOT post redundant HTML to usenet groups.
Get someone to show you how to turn this off in your mailer
if you don't know how!



Sent via Deja.com http://www.deja.com/
Before you buy.



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

* Re: use of attribute Pos
  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
  1 sibling, 1 reply; 23+ messages in thread
From: Ken Garlington @ 2000-10-16  0:00 UTC (permalink / raw)


"Alejandro Villanueva" <190921@cepsz.unizar.es> wrote in message
news:39EAF19B.6112F1C3@cepsz.unizar.es...
> Robert Dewar wrote:

[snip]

> > Also, please do NOT post redundant HTML to usenet groups.
> > Get someone to show you how to turn this off in your mailer
> > if you don't know how!
> >
>
> Sure I know how to do it!! But you are the very first person saying that
> to me... I can see a lot of HTML in usenet...

There's a lot of poor netiquette all over the place. Here's some places that
attempt to define guidelines:

http://www.rfc-editor.org/rfc/rfc1855.txt

http://cs17.eou.edu/~jefu/netiquette/netiquette.html






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

* Re: use of attribute Pos
  2000-10-16  0:00     ` Alejandro Villanueva
  2000-10-16  0:00       ` Ken Garlington
@ 2000-10-16  0:00       ` Robert Dewar
  2000-10-18  0:00         ` Alejandro Villanueva
  1 sibling, 1 reply; 23+ messages in thread
From: Robert Dewar @ 2000-10-16  0:00 UTC (permalink / raw)


In article <39EAF19B.6112F1C3@cepsz.unizar.es>,
  Alejandro Villanueva <190921@cepsz.unizar.es> wrote:
> Robert Dewar wrote:
> Excuse me Robert, but I thought I was sure about it... NOBODY
> is perfect, are you? ;)

Absolutely not! That's why I never assume that I am sure about
an example of Ada I post. Anytime I post an Ada example it
has been compiled and run with GNAT (of course that is not
a 100.000% guarantee that it's right, but GNAT knows Ada a
whole lot better than I do :-)

That's all I am saying here, just take the trouble to test
out any suggestion you have before posting, it only takes
a couple of minutes, and if we all do it, we can make sure
that we don't make mistakes.

It is *because* no one is perfect that I suggest this!



Sent via Deja.com http://www.deja.com/
Before you buy.




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

* Re: use of attribute Pos
  2000-10-14  3:32   ` Robert Dewar
@ 2000-10-16  0:00     ` Alejandro Villanueva
  2000-10-16  0:00       ` Ken Garlington
  2000-10-16  0:00       ` Robert Dewar
  0 siblings, 2 replies; 23+ messages in thread
From: Alejandro Villanueva @ 2000-10-16  0:00 UTC (permalink / raw)


Robert Dewar wrote:

> In article <39E4A637.AE6EE630@cepsz.unizar.es>,
>   Alejandro Villanueva <190921@cepsz.unizar.es> wrote:
> > Then you should have done this:
> > -----
> > type Upper is new Character range 'A' .. 'Z';
> > begin
> > Put (Upper'Pos ('A'));
> > end;
> > -----
> > Output: 1
>
> Please test out examples before you post them, it avoids
> quite a lot of cases of blatant misinformation of this
> type.
>

Excuse me Robert, but I thought I was sure about it... NOBODY is
perfect, are you? ;)

>
> Also, please do NOT post redundant HTML to usenet groups.
> Get someone to show you how to turn this off in your mailer
> if you don't know how!
>

Sure I know how to do it!! But you are the very first person saying that
to me... I can see a lot of HTML in usenet...

>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

--
------------------------------------------------------
�Quieres Cobrar por Navegar en Internet?
Visita: http://www.navegana.com/dinero/flintstone.html
------------------------------------------------------
Alejandro Villanueva
190921@cepsz.unizar.es
------------------------------------------------------







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

* Re: use of attribute Pos
  2000-10-16  0:00       ` Robert Dewar
@ 2000-10-18  0:00         ` Alejandro Villanueva
  0 siblings, 0 replies; 23+ messages in thread
From: Alejandro Villanueva @ 2000-10-18  0:00 UTC (permalink / raw)


Well Robert, excuse me. I think you are right so I will test all my
examples in the future.

Robert Dewar wrote:

> In article <39EAF19B.6112F1C3@cepsz.unizar.es>,
>   Alejandro Villanueva <190921@cepsz.unizar.es> wrote:
> > Robert Dewar wrote:
> > Excuse me Robert, but I thought I was sure about it... NOBODY
> > is perfect, are you? ;)
>
> Absolutely not! That's why I never assume that I am sure about
> an example of Ada I post. Anytime I post an Ada example it
> has been compiled and run with GNAT (of course that is not
> a 100.000% guarantee that it's right, but GNAT knows Ada a
> whole lot better than I do :-)
>
> That's all I am saying here, just take the trouble to test
> out any suggestion you have before posting, it only takes
> a couple of minutes, and if we all do it, we can make sure
> that we don't make mistakes.
>
> It is *because* no one is perfect that I suggest this!
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.

--
------------------------------------------------------
�Quieres Cobrar por Navegar en Internet?
Visita: http://www.navegana.com/dinero/flintstone.html
------------------------------------------------------
Alejandro Villanueva
190921@cepsz.unizar.es
------------------------------------------------------







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

* Re: use of attribute Pos
  2000-10-16  0:00       ` Ken Garlington
@ 2000-10-18  0:00         ` Alejandro Villanueva
  0 siblings, 0 replies; 23+ messages in thread
From: Alejandro Villanueva @ 2000-10-18  0:00 UTC (permalink / raw)


Thanks, I'll take a look at those places...

Ken Garlington wrote:

> "Alejandro Villanueva" <190921@cepsz.unizar.es> wrote in message
> news:39EAF19B.6112F1C3@cepsz.unizar.es...
> > Robert Dewar wrote:
>
> [snip]
>
> > > Also, please do NOT post redundant HTML to usenet groups.
> > > Get someone to show you how to turn this off in your mailer
> > > if you don't know how!
> > >
> >
> > Sure I know how to do it!! But you are the very first person saying that
> > to me... I can see a lot of HTML in usenet...
>
> There's a lot of poor netiquette all over the place. Here's some places that
> attempt to define guidelines:
>
> http://www.rfc-editor.org/rfc/rfc1855.txt
>
> http://cs17.eou.edu/~jefu/netiquette/netiquette.html

--
------------------------------------------------------
�Quieres Cobrar por Navegar en Internet?
Visita: http://www.navegana.com/dinero/flintstone.html
------------------------------------------------------
Alejandro Villanueva
190921@cepsz.unizar.es
------------------------------------------------------







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

end of thread, other threads:[~2000-10-18  0:00 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-11  0:00 use of attribute Pos Philippe Torres
2000-10-11  0:00 ` Pat Rogers
2000-10-12  0:00   ` Philippe Torres
2000-10-12  0:00     ` Robert A Duff
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               ` Philippe Torres
2000-10-12  0:00               ` Pat Rogers
2000-10-12  0:00         ` mark.biggar
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

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