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,38fc011071df5a27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-05-30 17:49:43 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: 18k11tm001@sneakemail.com (Russ) Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X Date: 30 May 2003 17:49:43 -0700 Organization: http://groups.google.com/ Message-ID: References: <6a90b886.0305262344.1d558079@posting.google.com> <3ED41344.7090105@spam.com> <3ED46D81.FF62C34F@0.0> <3ED46E07.4340CABC@0.0> <3ED4F3FD.A0EF7079@alfred-hilscher.de> NNTP-Posting-Host: 128.102.146.44 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1054342183 14743 127.0.0.1 (31 May 2003 00:49:43 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 31 May 2003 00:49:43 GMT Xref: archiver1.google.com comp.lang.ada:38168 Date: 2003-05-31T00:49:43+00:00 List-Id: Stephen Leake wrote in message news:... > 18k11tm001@sneakemail.com (Russ) writes: > > > > Occasionally I run into code that looks something like: > > > > > > production_total( total_class ).shift( shift_index ) := > > > production_total( total_class ).shift( shift_index ) + count; > > > > > > That would read a lot cleaner as: > > > > > > production_total( total_class ).shift( shift_index ) += count; > > > > Couldn't have said it better myself. > > What is wrong with having a style guide that says: > > "If you have statements like > production_total( total_class ).shift( shift_index ) := > production_total( total_class ).shift( shift_index ) + count; > > you must write an appropriate Increment function, and use it instead" Because it's one hell of a lot easier, not to mention less error-prone, to just use +=. That's what Ada is all about. I don't blame anyone for disliking ++, but += should be your friend. > Problem solved; no need for language change or compiler support. Yes, but it's far from the best and simplest solution. > > And let's not forget that +=, -=, etc. also allow for more efficient > > in-place vector/matrix operations because they avoid the need for a > > temporary. If you don't understand this, that's OK, but please don't > > argue with me because you will be wrong. > > Same argument; a package that provides vector/matrix math must provide > an appropriate in-place Increment function. > > Ada is about ease of reading, _not_ about ease of writing. += improves readability too! Which is clearer, A += B or Add(A,B) The latter doesn't make clear what exactly is being done. Is the result ending up in A or B? Yes, you can write something that would be a bit clearer, like Add ( Into=>A, Add=>B ) but it still would not be as clear or as elegant as A += B. In-place operations on a variables are so fundamental that they deserves their own syntax. If you can't handle that, what kind of "programmer" are you?