comp.lang.ada
 help / color / mirror / Atom feed
* Fussy Standard: what is modulo Address?
@ 2003-01-22  7:33 Victor Porton
  0 siblings, 0 replies; 11+ messages in thread
From: Victor Porton @ 2003-01-22  7:33 UTC (permalink / raw)


13.3.22-23. "For a prefix X that denotes a subtype or object:
X'Alignment... Address modulo the Alignment".

The Standard seems to not explain what is "Address modulo".

It can be:

1. The integer mathematical operation fpr 
System.Storage_Element.Integer_Address.

2. Operation "mod" for System.Address, defined also in System.

Moreover the Standard probably does not say anything about relations of 
these two operations (they should be the same as people seem to tend to 
naturally consider these the same).

We should correct it, yes?



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

* Re: Fussy Standard: what is modulo Address?
@ 2003-01-22  8:05 Grein, Christoph
  2003-01-22 16:40 ` Robert A Duff
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Grein, Christoph @ 2003-01-22  8:05 UTC (permalink / raw)
  To: comp.lang.ada

> 13.3.22-23. "For a prefix X that denotes a subtype or object:
> X'Alignment... Address modulo the Alignment".
> 
> The Standard seems to not explain what is "Address modulo".
> 
> It can be:
> 
> 1. The integer mathematical operation fpr 
> System.Storage_Element.Integer_Address.
> 
> 2. Operation "mod" for System.Address, defined also in System.
> 
> Moreover the Standard probably does not say anything about relations of 
> these two operations (they should be the same as people seem to tend to 
> naturally consider these the same).
> 
> We should correct it, yes?

You seem to have point here. Report it to ada-comment@ada-auth.org.



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

* Re: Fussy Standard: what is modulo Address?
  2003-01-22  8:05 Fussy Standard: what is modulo Address? Grein, Christoph
@ 2003-01-22 16:40 ` Robert A Duff
  2003-01-22 20:21 ` Victor Porton
  2003-01-23  0:43 ` Victor Porton
  2 siblings, 0 replies; 11+ messages in thread
From: Robert A Duff @ 2003-01-22 16:40 UTC (permalink / raw)


"Grein, Christoph" <christoph.grein@eurocopter.com> writes:

> > 13.3.22-23. "For a prefix X that denotes a subtype or object:
> > X'Alignment... Address modulo the Alignment".
> > 
> > The Standard seems to not explain what is "Address modulo".
> > 
> > It can be:
> > 
> > 1. The integer mathematical operation fpr 
> > System.Storage_Element.Integer_Address.
> > 
> > 2. Operation "mod" for System.Address, defined also in System.
> > 
> > Moreover the Standard probably does not say anything about relations of 
> > these two operations (they should be the same as people seem to tend to 
> > naturally consider these the same).
> > 
> > We should correct it, yes?
> 
> You seem to have point here. Report it to ada-comment@ada-auth.org.

I don't think so.  "Modulo" means the "mod" operator for
System.Address.  This is defined in 13.7.1(8).  The AARM states this
explicitly in 13.3(24.b) and 13.7.1(11.b).

The manual does not define the semantics of this "mod" operator.  How
could it?  Address is just a private type provided by the implementer --
it could be anything.

- Bob



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

* Re: Fussy Standard: what is modulo Address?
  2003-01-22  8:05 Fussy Standard: what is modulo Address? Grein, Christoph
  2003-01-22 16:40 ` Robert A Duff
@ 2003-01-22 20:21 ` Victor Porton
  2003-01-22 23:06   ` Simon Wright
  2003-01-23  0:23   ` Robert A Duff
  2003-01-23  0:43 ` Victor Porton
  2 siblings, 2 replies; 11+ messages in thread
From: Victor Porton @ 2003-01-22 20:21 UTC (permalink / raw)


In article <wccn0lt2l47.fsf@shell01.theworld.com>,
	Robert A Duff <bobduff@shell01.TheWorld.com> writes:
> "Grein, Christoph" <christoph.grein@eurocopter.com> writes:
> 
>> > 13.3.22-23. "For a prefix X that denotes a subtype or object:
>> > X'Alignment... Address modulo the Alignment".
>> > 
>> > The Standard seems to not explain what is "Address modulo".
>> > 
>> > It can be:
>> > 
>> > 1. The integer mathematical operation fpr 
>> > System.Storage_Element.Integer_Address.
>> > 
>> > 2. Operation "mod" for System.Address, defined also in System.
>> > 
>> > Moreover the Standard probably does not say anything about relations of 
>> > these two operations (they should be the same as people seem to tend to 
>> > naturally consider these the same).
>> > 
>> > We should correct it, yes?
>> 
>> You seem to have point here. Report it to ada-comment@ada-auth.org.
> 
> I don't think so.  "Modulo" means the "mod" operator for
> System.Address.  This is defined in 13.7.1(8).  The AARM states this
> explicitly in 13.3(24.b) and 13.7.1(11.b).

So, it is stated  nly in AARM, not in ARM? It is a bug.

> The manual does not define the semantics of this "mod" operator.  How
> could it?  Address is just a private type provided by the implementer --
> it could be anything.

The manual should define relations between System.Address and
System.Storage_Element.Integer_Address. To define these seems being 
just forgotten. No these relations which should be true accordingly 
human intuition may have bad impact on reliability.



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

* Re: Fussy Standard: what is modulo Address?
  2003-01-22 20:21 ` Victor Porton
@ 2003-01-22 23:06   ` Simon Wright
  2003-01-23  0:23   ` Robert A Duff
  1 sibling, 0 replies; 11+ messages in thread
From: Simon Wright @ 2003-01-22 23:06 UTC (permalink / raw)


porton@ex-code.com (Victor Porton) writes:

> The manual should define relations between System.Address and
> System.Storage_Element.Integer_Address. To define these seems being 
> just forgotten. No these relations which should be true accordingly 
> human intuition may have bad impact on reliability.

It seems to me that when the ARM goes to some trouble to say that
System.Address is implementation-defined it is probably deliberate.

And there is a perfectly clear relation between System.Address and
System.Storage_Elements.Integer_Address in the functions
System.Storage_Elements.To_Address, To_Integer.



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

* Re: Fussy Standard: what is modulo Address?
  2003-01-22 20:21 ` Victor Porton
  2003-01-22 23:06   ` Simon Wright
@ 2003-01-23  0:23   ` Robert A Duff
  2003-01-23 13:12     ` Wes Groleau
  1 sibling, 1 reply; 11+ messages in thread
From: Robert A Duff @ 2003-01-23  0:23 UTC (permalink / raw)


porton@ex-code.com (Victor Porton) writes:

> > I don't think so.  "Modulo" means the "mod" operator for
> > System.Address.  This is defined in 13.7.1(8).  The AARM states this
> > explicitly in 13.3(24.b) and 13.7.1(11.b).
> 
> So, it is stated  nly in AARM, not in ARM? It is a bug.

The reason I put it in the AARM only is that I thought it was obvious
what it must mean.  What else could "address modulo mumble" mean besides
the "mod" operator on type Address?  So I disagree that it's a bug.

> > The manual does not define the semantics of this "mod" operator.  How
> > could it?  Address is just a private type provided by the implementer --
> > it could be anything.
> 
> The manual should define relations between System.Address and
> System.Storage_Element.Integer_Address. To define these seems being 
> just forgotten. No these relations which should be true accordingly 
> human intuition may have bad impact on reliability.

I don't see the problem here.  Type Address and Integer_Address are too
hardware-dependent to say much about them (or the relationships between
them) in the RM.

- Bob



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

* Re: Fussy Standard: what is modulo Address?
  2003-01-22  8:05 Fussy Standard: what is modulo Address? Grein, Christoph
  2003-01-22 16:40 ` Robert A Duff
  2003-01-22 20:21 ` Victor Porton
@ 2003-01-23  0:43 ` Victor Porton
  2003-01-23 14:06   ` Robert A Duff
  2 siblings, 1 reply; 11+ messages in thread
From: Victor Porton @ 2003-01-23  0:43 UTC (permalink / raw)


In article <wcc1y34k92a.fsf@shell01.theworld.com>,
	Robert A Duff <bobduff@shell01.TheWorld.com> writes:
> porton@ex-code.com (Victor Porton) writes:
> 
>> > I don't think so.  "Modulo" means the "mod" operator for
>> > System.Address.  This is defined in 13.7.1(8).  The AARM states this
>> > explicitly in 13.3(24.b) and 13.7.1(11.b).
>> 
>> So, it is stated  nly in AARM, not in ARM? It is a bug.
> 
> The reason I put it in the AARM only is that I thought it was obvious
> what it must mean.  What else could "address modulo mumble" mean besides
> the "mod" operator on type Address?  So I disagree that it's a bug.

It also may mean about the value of 'Address attribute which is 
universal integer, not System.Address.

>> > The manual does not define the semantics of this "mod" operator.  How
>> > could it?  Address is just a private type provided by the implementer --
>> > it could be anything.
>> 
>> The manual should define relations between System.Address and
>> System.Storage_Element.Integer_Address. To define these seems being 
>> just forgotten. No these relations which should be true accordingly 
>> human intuition may have bad impact on reliability.
> 
> I don't see the problem here.  Type Address and Integer_Address are too
> hardware-dependent to say much about them (or the relationships between
> them) in the RM.

IMO, it should be "A mod M = System.Storage_Element.To_Integer(A) mod M"
for any A of type System.Address and integer M (probably with some 
restrictions related to memory segments...)



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

* Re: Fussy Standard: what is modulo Address?
@ 2003-01-23  6:53 Grein, Christoph
  0 siblings, 0 replies; 11+ messages in thread
From: Grein, Christoph @ 2003-01-23  6:53 UTC (permalink / raw)
  To: comp.lang.ada

> > The reason I put it in the AARM only is that I thought it was obvious
> > what it must mean.  What else could "address modulo mumble" mean besides
> > the "mod" operator on type Address?  So I disagree that it's a bug.
> 
> It also may mean about the value of 'Address attribute which is 
> universal integer, not System.Address.

????

RM 13.3(11) ... The value of this attribute is of type System.Address.



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

* Re: Fussy Standard: what is modulo Address?
  2003-01-23  0:23   ` Robert A Duff
@ 2003-01-23 13:12     ` Wes Groleau
  2003-01-23 14:10       ` Robert A Duff
  0 siblings, 1 reply; 11+ messages in thread
From: Wes Groleau @ 2003-01-23 13:12 UTC (permalink / raw)


Robert A Duff wrote:
> what it must mean.  What else could "address modulo mumble" mean besides
> the "mod" operator on type Address?  So I disagree that it's a bug.

Bob, I don't necessarily agree with Victor in general, but...

  "modulo" means "mod" is fairly plain, but
   "mod"   means "mod" is plainer.   :-)




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

* Re: Fussy Standard: what is modulo Address?
  2003-01-23  0:43 ` Victor Porton
@ 2003-01-23 14:06   ` Robert A Duff
  0 siblings, 0 replies; 11+ messages in thread
From: Robert A Duff @ 2003-01-23 14:06 UTC (permalink / raw)


porton@ex-code.com (Victor Porton) writes:

> In article <wcc1y34k92a.fsf@shell01.theworld.com>,
> 	Robert A Duff <bobduff@shell01.TheWorld.com> writes:
> > porton@ex-code.com (Victor Porton) writes:
> > 
> >> > I don't think so.  "Modulo" means the "mod" operator for
> >> > System.Address.  This is defined in 13.7.1(8).  The AARM states this
> >> > explicitly in 13.3(24.b) and 13.7.1(11.b).
> >> 
> >> So, it is stated  nly in AARM, not in ARM? It is a bug.
> > 
> > The reason I put it in the AARM only is that I thought it was obvious
> > what it must mean.  What else could "address modulo mumble" mean besides
> > the "mod" operator on type Address?  So I disagree that it's a bug.
> 
> It also may mean about the value of 'Address attribute which is 
> universal integer, not System.Address.

'Address returns System.Address.  And that's (supposed to be) a private
type, for the very reason that we don't know what sort of thing it is.

> >> > The manual does not define the semantics of this "mod" operator.  How
> >> > could it?  Address is just a private type provided by the implementer --
> >> > it could be anything.
> >> 
> >> The manual should define relations between System.Address and
> >> System.Storage_Element.Integer_Address. To define these seems being 
> >> just forgotten. No these relations which should be true accordingly 
> >> human intuition may have bad impact on reliability.
> > 
> > I don't see the problem here.  Type Address and Integer_Address are too
> > hardware-dependent to say much about them (or the relationships between
> > them) in the RM.
> 
> IMO, it should be "A mod M = System.Storage_Element.To_Integer(A) mod M"
> for any A of type System.Address and integer M (probably with some 
> restrictions related to memory segments...)

The part about "probably with some restrictions related to memory
segments..." is hand waving.  The RM knows nothing about memory
segments, so it can't make rules referring to them.

The "A mod M = System.Storage_Element.To_Integer(A) mod M" is what I
would expect on a simple flat-address-space machine.  But it's not what
I expect on *all* machines -- in particular, it can't possibly be true
on a segmented machine (as you say above).  It seems unhelpful for the
RM to say "A mod M = System.Storage_Element.To_Integer(A) mod M" on all
machines, except for some machines where it's not true.  Saying "except
on segmented architectures" is also unhelpful, since the term is not
defined in the RM.  And I have no idea how to define it in RM terms.

For features at this level, it's much better to trust implementers to do
something sensible.  Implementers know about the particular hardware
they're targetting.  For a language designer to address this issue
would require the language designer to imagine all *possible* hardware
architectures, which is not easy.  ;-)

By the way, why are you picking on "mod"?  There are other operators
that have the same issue.  For example, the "+" that takes an Address
and a Storage_Offset will not necessarily behave the same as the "+" on
Integer_Address.  It will on simple flat-address-space machines
(presuming Integer_Address is a modular type, which is what you normally
expect), but on segmented machines, "+" on Address would probably wrap
around within a segment, whereas "+" on Integer_Address behaves as
defined for the integer type.

If you're doing address arithmetic, you ought to use the operators on
Address.  Integer_Address is mainly for doing things like printing out
addresses for debugging.

- Bob



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

* Re: Fussy Standard: what is modulo Address?
  2003-01-23 13:12     ` Wes Groleau
@ 2003-01-23 14:10       ` Robert A Duff
  0 siblings, 0 replies; 11+ messages in thread
From: Robert A Duff @ 2003-01-23 14:10 UTC (permalink / raw)


Wes Groleau <wesgroleau@despammed.com> writes:

> Robert A Duff wrote:
> > what it must mean.  What else could "address modulo mumble" mean besides
> > the "mod" operator on type Address?  So I disagree that it's a bug.
> 
> Bob, I don't necessarily agree with Victor in general, but...
> 
>   "modulo" means "mod" is fairly plain, but
>    "mod"   means "mod" is plainer.   :-)

Well, perhaps, but I expect people to understand that "multiply" or
"times" in an English sentence means the "*" operator of whatever type
we're talking about.  Likewise, "modulo" refers to the "mod" operator.

You wouldn't say ``This is "*"'d by that.''  You would say ``This is
multiplied by that.''

Anyway, you *might* convince me that I should have written it more
clearly.  But I doubt that you could convince the ARG that it is
important enough to change in the next revision of the RM.  Especially
when the AARM annotations make it 100% clear what the author meant.

- Bob



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

end of thread, other threads:[~2003-01-23 14:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-01-22  8:05 Fussy Standard: what is modulo Address? Grein, Christoph
2003-01-22 16:40 ` Robert A Duff
2003-01-22 20:21 ` Victor Porton
2003-01-22 23:06   ` Simon Wright
2003-01-23  0:23   ` Robert A Duff
2003-01-23 13:12     ` Wes Groleau
2003-01-23 14:10       ` Robert A Duff
2003-01-23  0:43 ` Victor Porton
2003-01-23 14:06   ` Robert A Duff
  -- strict thread matches above, loose matches on Subject: below --
2003-01-23  6:53 Grein, Christoph
2003-01-22  7:33 Victor Porton

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