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!jarvis.csri.toronto.edu!rutgers!apple!oliveb!mipos3!omepd!inteloc!vladimir From: vladimir@inteloc.intel.com (Vladimir G. Ivanovic) Newsgroups: comp.lang.ada Subject: Re: Questions on Ada... Message-ID: <4611@omepd.UUCP> Date: 6 Jul 89 19:02:46 GMT References: <3034@wpi.wpi.edu> <979@cbnewsl.ATT.COM> Sender: news@omepd.UUCP Reply-To: vladimir@inteloc.UUCP (Vladimir G. Ivanovic) Distribution: usa Organization: BiiN, Hillsboro List-Id: In article <979@cbnewsl.ATT.COM> arny@cbnewsl.ATT.COM (arny.b.engelson) writes: >There is more than one way to do this. One alternative is to use overlays. >Simply declare an integer array of the proper length, use an address clause >to overlay it at the location occupied by the structure you are copying >from, and copy it to an integer array overlayed at the destination address. >Another alternative is to use unchecked conversion from one type to another. >Again, the Ada purists will be up in arms (overlays are officially erroneous), >but the concept is very useful in some situations. I agree about the utility, but disagree about the "officially erroneous" comment attributed to Ada purists. In fact, I'd say there are entire classes of problems that cannot be solved without using Unchecked_Conversion. A more understanding approach to strong typing, Ada and program construction stresses the utility of letting the compiler do as much work for the programmer as possible. Heck, I'd buy in a flash a system that allowed me to specify a problem domain complete with hems and haws and retractions and contradictions inherent in unstructured human thought. The problem with using Unchecked_Conversion is that the programmer is saying to the compiler, "Trust me. I really do know what I'm doing." The compiler can't therefore check for consistency by asking "Does this make sense?" i.e. by checking types. Time and time again, experienced Ada programmers say that it takes a fair bit of time before a person begins to think Ada-think. In other words, it takes time (and understanding) before programmers learn to organize their programs as a collection of objects (data structures with associated methods = packages) passing messages (procedure calls and rendezvous). The original posting asking "How can I translate this into Ada?" is a stage all Ada programmers go through. There is a better way, and it requires a different mindset.