From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,83d7c4caadb45100 X-Google-Attributes: gid103376,public From: ncohen@watson.ibm.com (Norman H. Cohen) Subject: Re: DECAda/VMS - calling GETJPI Date: 1996/06/07 Message-ID: <4p9k71$11a1@watnews1.watson.ibm.com>#1/1 X-Deja-AN: 158979362 distribution: world references: <4p183b$2vs@linus.mitre.org> <4p1v56$214@linus.mitre.org> <4p547s$n99@krusty.irvine.com> organization: IBM T.J. Watson Research Center reply-to: ncohen@watson.ibm.com newsgroups: comp.lang.ada Date: 1996-06-07T00:00:00+00:00 List-Id: In article <4p547s$n99@krusty.irvine.com>, adam@irvine.com (Adam Beneschan) writes: |> mfb@mbunix.mitre.org (Michael F Brenner) writes: ... |> >Paragraph 28 of Section 4.6 states that constraint_error on conversion |> >. This is a typographical |> >error. It makes no sense, and it contradicts both the above three |> >paragraphs in the Reference Manual, and it contradicts the fact that |> >constraint_error is raised only on converting to a non-modular type. |> > |> >It should be changed to read >non-modular type>. |> |> I'm not qualified to determine whether this is a typo. Actually, the |> only people that can say for sure are those involved in writing the |> RM. I'll have to admit that I don't know what the paragraph as |> written means. It's not a typo, but it is a case of the RM getting overly pedantic and obscure. For reasons that Tucker may remember but I do not, all numeric types other than modular types are described as having an infinite "set of values", some of which belong to a finite "base range": RM95 3.5.4(8): "The set of values for a signed integer type is the (infinite) set of mathematical integers, though only values of the base range of the type are fully supported for run-time operations. The set of values for a modular integer type are the values from 0 to one less than the modulus, inclusive." RM95 3.5.6(8): "The set of values of a floating-point type is the (infinite) set of rational numbers." RM95 3.5.9(8): "The set of values of a fixed-point type comprise integral multiples of number called the _small_ of the type." (Base ranges are described in RM95 3.5(6).) Thus RM95 4.6(28) is correct when it states: "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." (Nonnumeric value conversions are always to a target type that has a corresponding value for each value of the operand type. Since all numeric types other than modular types are conceptually infinite, conversions to a numeric type other than a modular type are always to such a target type; conversions to a modular type are not.) The word "This" in 4.6(28) refers to the raising of Constraint_Error specifically because there is no corresponding value in the target type, not to the raising of Constraint_Error in general. Yet we all know that given the declaration type T is range 1 .. 10; the conversion T(11) raises Constraint_Error, so what's going on here? The answer is found in RM95 4.6(51): "After conversion of the value to the target type, if the target subtype is constrained, a check is performed that the value satisfies this constraint." In short, a value conversion consists of converting to the target type, which can only raise Constraint_Error when the target type is a modular type, followed by a check that the converted value obeys the constraint of the target subtype, which generally has the potential to raise Constraint_Error for any target type. -- Norman H. Cohen ncohen@watson.ibm.com