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,FREEMAIL_FROM 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-06-29 21:05:19 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: 18k11tm001@sneakemail.com (Russ) Newsgroups: comp.lang.ada Subject: Re: status of Ada STL? Date: 29 Jun 2002 21:05:19 -0700 Organization: http://groups.google.com/ Message-ID: 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> NNTP-Posting-Host: 63.194.87.148 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1025409919 8769 127.0.0.1 (30 Jun 2002 04:05:19 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 30 Jun 2002 04:05:19 GMT Xref: archiver1.google.com comp.lang.ada:26792 Date: 2002-06-30T04:05:19+00:00 List-Id: "Marin David Condic" wrote in message news:... > O.K. that's probably more accurate. My point was that the whole "vision" of > the "=" operator is different from what Ada does. In C and C++ you can write > an expression like: "X = Y = Z = 0 ;" because the "=" is viewed as a kind of > binary function with side effects. (First you call "Z = 0" which has side > effects on Z, then "Y = Z" which has side effects on Y, etc...) Whereas in > Ada, the whole concept of an expression such as "X := Y := Z := 0;" would be > foreign and incomprehensible, because it isn't viewed as a function with > side effects, but as a fundamental statement of the language - "object gets > the value of an expression". 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". I confess I don't know didly about assignment in Ada, but I can tell you that assignment in C++ for user defined types is a member function. It does whatever the implementer of the class tells it to do. And it is considered good form to have it return a reference to "*this" so that assignment can be cascaded, as in "A = B = C = D". If a C++ class does not explicitly define an assignment operator, the compiler will define one by default. The default assignment operator is often perfectly good. In fact, the only time the class should define its own assignment operator is when the it contains a pointer to data on the heap that needs to be copied in the assignment operation. Otherwise, you are much better off with the default. The same applies to copy constructors, by the way. Newbies often misunderstand this and write their own unnecessarily, which can only cause unnecessary bugs. > So what falls to the right of ":=" has to be an "expression" and the only > way for that to be an expression is for ":=" to be a binary function which > starts redefining what it means to be a function because of side effects and > then of course you've got the leftmost ":=" which can't any longer be > "object gets expression" because now ":=" is a function and that means you > need to allow function calls where the return value is discarded and..... > (deep breath) Pretty soon, you're thoroughly hosed - and for what? So that > some ex C/C++ programmers don't have to go through the change of life > necessary to get comfortable with "X := X + 1;"? (Suggestion: Get Over It! > :-) Ya, and what about Cobol, Basic, Fortran, Java, Perl, Python, Matlab, and Mathematica programmers? Should they all just get lost too? 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++. > I'd think that tinkering with something this fundamental in the language to > change it into a function with side effects would have such profound > implications, that it would either "break" Ada or Ada would start to take on > the characteristics of "organically grown"* (rather than "designed") that I > consider to be the style of C/C++. It would be A Bad Thing. > > *(IMHO, C++ shows all the signs of following the Harley Davidson Design > Methodology - "If it breaks, make it bigger. If it sticks out, chrome it." > :-) I'll bet you wouldn't say that at a gathering of Hell's Angels. ;^)