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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c9d5fc258548b22a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder3.cambriumusenet.nl!feeder1.cambriumusenet.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: How do I write directly to a memory address? Date: Wed, 2 Mar 2011 20:23:00 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <67063a5b-f588-45ea-bf22-ca4ba0196ee6@l11g2000yqb.googlegroups.com> <31c357bd-c8dc-4583-a454-86d9c579e5f4@m13g2000yqb.googlegroups.com> <05a3673e-fb97-449c-94ed-1139eb085c32@x1g2000yqb.googlegroups.com> <4d4c232a$0$28967$882e7ee2@usenet-news.net> <4D4D6506.50909@obry.net> <4d50095f$0$22393$882e7ee2@usenet-news.net> <4d6d56c4$0$11509$882e7ee2@usenet-news.net> <4D6D6A90.2090108@obry.net> <4d6d6e60$0$11509$882e7ee2@usenet-news.net> <4d6e53c1$0$21954$882e7ee2@usenet-news.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1299118985 22675 69.95.181.76 (3 Mar 2011 02:23:05 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Thu, 3 Mar 2011 02:23:05 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-RFC2646: Format=Flowed; Response Xref: g2news2.google.com comp.lang.ada:18725 Date: 2011-03-02T20:23:00-06:00 List-Id: "Hyman Rosen" wrote in message news:4d6e53c1$0$21954$882e7ee2@usenet-news.net... > On 3/1/2011 7:41 PM, Randy Brukardt wrote: >> If "the environment" had a strongly typed Ada interface, > > then the error could not occur there. > > Isn't it the case that Ada proponents argue that Ada is a good > (and possibly the best) programming language in general, and not > just when interfacing to a strongly typed Ada interface? I think most Ada proponents are *only* thinking about strongly-typed interfaces when they are thinking about Ada as a great programming language. Ada can do little to help when using a weakly-typed interface, nor can any other programming language. You might remember when I referred to "98% of code being garbage, including most Ada code" (for which you called me a "crank"). One of the things I was thinking of is weakly-typed interfaces without little runtime checking as well. Those are garbage in any programming language, including Ada. (Note again that just because they are garbage doesn't mean that you can't use them - it's not that unusual to take an empty bottle or can or junk mail out of the trash and use it for something.) > I sense an attitude of "If it's good, thank Ada. If it's bad, it's the > fault of something else." No, it's the fault of the interface, not necessarily the items on either side. There might very well being nothing wrong with the "something else", either. The problem (in implementation terms) is that there is no consistency check across an interface. Specifically, when you use "pragma Import" in Ada code, you are telling the Ada compiler what the other side expects for parameter types, number of parameters, and the like. There can be no check that these declarations are correct, in Ada or in the other language. (At least not unless you are the compiler vendor for both languages, a highly unlikely situation for most of us.) The effect is that any error in these specifications causes random behavior that is often very difficult to trace to the actual mistake. Probably 75% of the effort debugging Claw was tracking down these sorts of problems (along with related compiler bugs). OTOH, if both subsystems were written in Ada (or in C++ for that matter), the compiler could enforce consistency between the calls and declarations, and the majority of those errors would be detected before they caused any problems at all. That's why I have always believed that to truly get the benefits of Ada, you really have to write the vast majority of the system in Ada. If someone is trying to integrate major subsystems built in a variety of different languages, they greatly increase the chances for errors *at the interfaces* and reduce the value of Ada (and the other languages as well). Indeed, even though it is bad for business, I try to discourage people from just writing a small part of a system in Ada, as I believe that the hassles of doing so will most probably outweight the gains. (Plenty of others disagree with me on that.) This was one of the major reasons that we built Claw to allow creation of Windows GUI programs all in Ada (and as much as possible in an Ada paradyme). Having to go outside of Ada for major parts of an application greatly reduces the benefits of Ada. Ideally, you would write everything in one language (hopefully Ada), but that isn't always possible (you might be forced to use SQL, or some GUI for which there is no Ada equivalent, etc.). Note that this isn't just an Ada-specific phenomona. It applies equally well to C++ and Java and pretty much any other programming language out there. Maybe even more so, since Ada at least tries to make a facility for using other languages available within the language (most other languages require vendor-specific features to do that). Anyway, most of the point here is that the *need* to interface immediately reduces the value of a strongly typed language like Ada. (And it also reduces the value of program analysis tools and pretty much anything else that can be done before the execution of the program - which is the only point where bugs can be automatically detected rather than having to be ferreted out by testing/debugging.) Randy.