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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!lll-winken!uwm.edu!zaphod.mps.ohio-state.edu!samsung!xylogics!merk!alliant!linus!eachus From: eachus@linus.mitre.org (Robert I. Eachus) Newsgroups: comp.lang.ada Subject: Re: "silly" (?) Ada semantics Message-ID: Date: 6 Jun 90 18:12:28 GMT References: <1919@sparko.gwu.edu> <644579683.25696@minster.york.ac.uk> Sender: usenet@linus.mitre.org Organization: The Mitre Corporation, Bedford, MA In-reply-to: ken@minster.york.ac.uk's message of 5 Jun 90 09:54:43 GMT List-Id: In article <644579683.25696@minster.york.ac.uk> ken@minster.york.ac.uk writes: > I thought Ada was targetted at high integrity mission critical > software? Is it a good idea to defer errors to run-time? No, but it is an even worse idea to allow SOME compilers to reject a program because it thinks the program is silly, or because as, "a matter of taste" some vendor thinks that a particular construct is not a good idea. In this particular case, it is obvious at compile time that the aggregate must be invalid, but in general it is not possible to decide whether an aggregate is "legal" until run time: A: String(1..X) := "foo"; Given that in many cases the decision must be deferred until run-time, the chosen policy was that mismatch is never a compile-time error, but a compiler is expected to flag a known mismatch. A similar, but less surprising case is: declare X: Integer; begin X := Integer'LAST + Integer'LAST; end; A compiler can flag this, and in fact it can replace the assignment statement with "raise CONSTRAINT_ERROR;", but it is required to generate code... -- Robert I. Eachus with STANDARD_DISCLAIMER; use STANDARD_DISCLAIMER; function MESSAGE (TEXT: in CLEVER_IDEAS) return BETTER_IDEAS is...