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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8bf89a9bbd99a65e X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: array conversion - how to do? Date: 1997/06/27 Message-ID: #1/1 X-Deja-AN: 253087461 References: <5opej8$rv5$1@gonzo.sun3.iaf.nl> <33B3DE95.41EF@does.not.exist.com> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-06-27T00:00:00+00:00 List-Id: Geert says <<> I could imagine why it would not be possible to convert String > to ASCII_String, since that conversion might need time-consuming > checks. The conversion in the example is completely safe though, > which is statically checkable for the compiler. >> YOu are trying to introduce into Ada a semantic concept that is completely missing at the moment, namely the idea that conversions should be subdivided into those that may raise CE and those that are known to be CE-safe at compile time. Such distinctions are reasonable at the implementation level, but I find the idea of basing legality on such considerations to be a large and very unwelcome increase in semantic complexity. In Ada, a subtype check is needed for a subtype conversion period. If the compiler can optimize away the check fine. The rules on conversion of arrays seem entirely consistent with this point of vi9ew. You worry about writing the loop, but a good compiler should be able to generate efficient code for that loop. After all the checks will all get eliminated, and then there is no reason to think the loop will generate code any different on a typical machine from the conversion.