comp.lang.ada
 help / color / mirror / Atom feed
From: dewar@cs.nyu.edu (Robert Dewar)
Subject: Re: DECAda/VMS - calling GETJPI
Date: 1996/06/04
Date: 1996-06-04T00:00:00+00:00	[thread overview]
Message-ID: <dewar.833897047@schonberg> (raw)
In-Reply-To: 4p183b$2vs@linus.mitre.org


Mike Brenner says

"That's quite right, GNAT gives the error message below, but in doing
so it violates the Ada 95 Reference Manual and Rationale. Specifically,
(Rationale 3.3.2 fourth paragraph): The normal arithmetic operations
apply [to modular types] ... overflow cannot occur. (3.3.2 fifth paragraph)
Conversion from modular to signed integer types works in a useful manner
so that overflow does not occur. (3.3.2 sixth paragraph) We can think"

Yes, that's right GNAT violates the Rationale here. That's because the
Rationale is wrong. TO be fair, the problem is that it reflects the
language design as it was prior to the meeting in England.

Mike, always read the RM, not the Rationale, when they disagree, the
Ratoinale has no official status whatsoever. You cannot violate the
Rationale really, since it is not an official document. You can 
disagree with it, and most certainly should, when the Rationale is
incorrect.

The RM is quite clear on this point (I notice you did not try to quote
the RM to back up your incorrect interpretation, though it is certainly
understandable that you would assume that what you read in the Rationale
was correct).

The conversion raises constraint error because the value in question is
outside the range of the target type. Nowhere in the RM can you find a
suggestion that modular types are treated specially in such
conversions because there is no such special treatment.

There are not many technical errors in the Rationale of this type. All the
ones I know about are in this category, they reflect a change to the language
made late on, where the Rationale did not track the change.

It would be quite useful to have a comprehensive errata list for the Rationale,
but I do not know of one.

Anyway, bottom line, GNAT is right, Mike is wrong!

P.S. for the RM archeologists, the most obvious reference is in section
4.6

28   For the evaluation of a type_conversion that is a value conversion, the
operand is evaluated, and then the value of the operand is converted to a
corresponding value of the target type, if any.  If there is no value of the
target type that corresponds to the operand value, Constraint_Error is
raised; this can only happen on conversion to a modular type, and only when
the operand value is outside the base range of the modular type.  Additional
rules follow:

[seems clear enough to me!]





  reply	other threads:[~1996-06-04  0:00 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-06-03  0:00 DECAda/VMS - calling GETJPI Alan Paterson
1996-06-03  0:00 ` Ken Garlington
1996-06-03  0:00 ` Mats Weber
1996-06-03  0:00 ` Stuart Palin
1996-06-03  0:00   ` Michael F Brenner
1996-06-03  0:00     ` Robert Dewar
1996-06-04  0:00       ` Ken Garlington
1996-06-06  0:00         ` Robert Dewar
1996-06-04  0:00       ` Michael F Brenner
1996-06-04  0:00         ` Robert Dewar [this message]
1996-06-04  0:00           ` Michael F Brenner
1996-06-04  0:00             ` Robert Dewar
1996-06-04  0:00             ` Robert Dewar
1996-06-05  0:00               ` Wraparound on modular conversion (was: DECAda/VMS - calling GETJPI) Tucker Taft
1996-06-05  0:00                 ` Robert Dewar
1996-06-05  0:00               ` DECAda/VMS - calling GETJPI Robert A Duff
1996-06-05  0:00                 ` Robert Dewar
1996-06-05  0:00               ` Fergus Henderson
1996-06-05  0:00                 ` Robert A Duff
1996-06-05  0:00             ` Adam Beneschan
1996-06-07  0:00               ` Norman H. Cohen
1996-06-11  0:00                 ` Adam Beneschan
  -- strict thread matches above, loose matches on Subject: below --
1996-06-06  0:00 George Haddad
1996-06-07  0:00 ` Robert Dewar
replies disabled

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