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.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!software.org!blakemor From: blakemor@software.org (Alex Blakemore) Newsgroups: comp.lang.ada Subject: constraint error question for language lawyers Keywords: unreasonable language restrictions frustrated programmer Message-ID: <1802@software.software.org> Date: 8 Nov 90 17:18:32 GMT Sender: news@software.org Reply-To: blakemor@software.org (Alex Blakemore) Organization: Software Productivity Consortium, Herndon, Virginia List-Id: OK, language lawyers of the world. This one has stumped everyone I've asked locally, including several people who have worked with Ada since there were compilers for it. Vax Ada 2.1 and two versions of Verdix (5.x and 6.0.3) all behave in the same (unreasonable) manner - so there must be some obscure rule at work here. Does anyone a. know what that rule might be ? b. profess to have a reasonable explanation for its existence. The Question: Why does this procedure raise constraint error? It happens on the second assignment to dummy, but doesnt happen if dummy.len > 0 and appears to have something to do with the function call "&" ---------------- cut here ----------------- with text_io; use text_io; procedure bozo is type short is range 0 .. 10; type data is array (short range <>) of character; type var_text (len : short := 0) is record text : data (1 .. len); end record; dummy : var_text; -- unconstrained procedure do_nothing (d : data) is begin null; end do_nothing; begin put_line ("before"); dummy := (len => 0, text => ""); put_line ("during"); dummy := (len => dummy.len + 1, text => dummy.text & 'a'); put_line ("after"); exception when constraint_error => put_line ("constraint_error raised"); end bozo; ---------------- cut here ----------------- Here is the output: before during constraint_error raised -------------------------------------------------------------------- Alex Blakemore CSNET: blakemore@software.org Software Productivity Consortium 2214 Rock Hill Road Herndon, VA 22070 (703) 742-7125