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,c3a7c1845ec5caf9 X-Google-Attributes: gid103376,public From: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Equality operator overloading in ADA 83 Date: 1997/04/26 Message-ID: #1/1 X-Deja-AN: 237630780 References: <01bc4e9b$ac0e7fa0$72041dc2@lightning> <335CAEFE.35DC@elca-matrix.ch> <335E0A26.16D0@elca-matrix.ch> <33692089.5794807@news.airmail.net> Organization: New York University Newsgroups: comp.lang.ada Date: 1997-04-26T00:00:00+00:00 List-Id: Matthew Heaney said <> As usual, if you think something is incredible, it is probably because you did not carefully study the arguments on both sides. The reason that the above construct is illegal in Ada 83 is that it is potentially confusing, since once you are allowed to make such a declaration to a *variable* as opposed to a *constant*, then it sure looks as though you should be able to assign new string values to S, which is correct, and, in a *very* small step, it sure looks to people like you should be able to assign a different sized string. I often find Ada 95 programmers confused over this, and in particular you see something like: S : String := ""; with the intention of assigning variable length values later, and the Constraint_Error comes as a surprise. Note that if you try S : String; you get from GNAT: s.adb:1:23: unconstrained subtype not allowed (need initialization) which seems like a correct message, but does not solve this confusion. Yes, after some discussion in Ada 95, we decided that the balance between utility and confusion should be reevaluated, and put in this confusing feature (which we know is confusing) because the utility is perceived in retrospect as being worth it. Was this a good idea? I am not sure ... I certainly see it causing a lot of confusion. As to your comments about Ada programmers not understanding runtime computed constants, surely not? Well I guess people can have all kinds of misinformation, but it is a critical feature of Ada that you can declare such constants, and indeed a criticism of much Ada code that I see is that it unnecessarily uses variables, where constants would be preferable.