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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f51e93dacd9c7fca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-02 12:57:51 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: status of Ada STL? Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Tue, 2 Jul 2002 19:56:46 GMT References: <3d0ce154_5@news.bluewin.ch> <3d0e574d_2@news.bluewin.ch> <3d0fb5e8$1_3@news.bluewin.ch> <_cvS8.63267$UT.4317265@bgtnsc05-news.ops.worldnet.att.net> I like Ada too, and I don't want C or COBOL syntax for assignment in Ada, but MDC goes a bit too far here. Let me throw in some anti-Ada rhetoric, just for fun. (Sorry, Marin.) "Marin David Condic" writes: > "Russ" <18k11tm001@sneakemail.com> wrote in message > news:bebbba07.0206292005.45ad915a@posting.google.com... > > > > Perhaps I am missing something here, but when you say the expression > > "Z = 0" has a "side-effect" on Z you lose me. I don't see how > > assignment can be considered a "side effect". > > > Think of the user definable Ada function: > > function "=" (Left, Right : in Some_Type) return Boolean ; > > You can call it as: "="(L,R) or as: L = R and in either case it returns a > Boolean. But note that the formals Left and Right are *in* parameters - they > cannot be changed. If Assignment were to be a "function" instead of a > primitive statement then you'd have to be able to make Left be an *in out* > parameter - which is illegal in Ada. Changing "Left" in a function call is a > "side effect" which C/C++ allows, but Ada does not. As Robert Dewar likes to point out, Ada functions can have side effects so long as you make that fact unclear (by not passing them as parameters, but by writing upon global variables). Anyway, the "obvious" solution is to make ":=" a procedure rather than a function. Unfortunately, this solution doesn't work, which is why we didn't choose it. The reason is explained in the AARM (I'm too lazy to look up the reference right now), but it doesn't exactly make Ada look good. > You have the same capability in Ada. Yoy get assignment for free and if you > need to change the behavior, you derive from Controlled and define your own > Initialize, Adjust and Finalize subprograms. It actually works much cleaner > than Constructors and Destructors in C++ - especially where parameter > passing is concerned. The important thing is that you can acomplish the same > thing in Ada that you can in C++ ... Not quite. A serious limitation is that Adjust can't get its hands on the left-hand side. >... - you just can't do it in exactly the same > syntactic/semantic manner. > If you want to program in Ada - program in Ada. If you want to program in > Cobol - program in Cobol. What it you are not completely satisfied with either one (or any of the others)? What if you want to think about language design (rather than programming in existing languages)? > The important thing about Ada is that it provides all the capabilities you > get with other languages and additional capabilities you don't get with > other languages. Oh, come on! That's complete nonsense. If you can't name 100 capabilities off the top of your head that are not present in Ada (but are present in some other language), then you don't know enough about other languages to compare. >.... It doesn't do it identically - but a solution does exist. > You *can* achieve the same results and you get extra things on top of it. If > you want all those capabilities, then you work within the framework of what > Ada is and does. Asking Ada to look like and act like C++, Java, Fortran, > Cobol, Perl, etc. in order to make users of those languages more comfortable > is just a hopeless task. > > > > As I said, I have no idea how assignment works in Ada, but it would be > > nice if it worked as well as it does in C++. > > > It works just fine. It works (IMHO) better than it does in C++. Its far less > of a cobbled together hack that requires all sorts of "I before E except > after C or when sounded as A as in Neighbor and Weigh..." kinds of > exceptional rules. It just doesn't work *identically* to assignment in C++, > so one needs to learn how to work with The Ada Way. I hate that phrase ("The Ada Way"). Makes Ada folks sound like a bunch of unreasoning zealots. >... Trying to force Ada to > do assignment in an identical way to that of C++ is like trying to teach a > pig to dance. The results won't be very pretty or successful and it will > only annoy the pig. I've heard analogies made between Ada and pigs before, but never as an argument in *favor* of Ada. ;-) - Bob