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,38fc011071df5a27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-02 09:34:56 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X Date: 02 Jun 2003 12:29:25 -0400 Organization: NASA Goddard Space Flight Center (skates.gsfc.nasa.gov) 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: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1054572333 22740 128.183.235.92 (2 Jun 2003 16:45:33 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 2 Jun 2003 16:45:33 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Xref: archiver1.google.com comp.lang.ada:38374 Date: 2003-06-02T16:45:33+00:00 List-Id: 18k11tm001@sneakemail.com (Russ) writes: > Stephen Leake wrote in message > news:... > > 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. But you have only stated your opinion, not given a reason. Hmm, I guess by "easier", you mean "it's already written for me; I don't have to write it". That's true, but I object to the qualification "a hell of a lot"; it's a minor effort. On the other hand, modifying the language in any way is a _major_ effort. So we have to talk about costs and benefits, not just whether something is good at all. > I don't blame anyone for disliking ++, but += should be your friend. Many people disagree with you; it helps to give actual reasons, or just say "in my opinion". > > Problem solved; no need for language change or compiler support. > > Yes, but it's far from the best and simplest solution. How far? 42 microns, no doubt :). (Extra points for identifying the cultural origions of that number :). Obviously, I think it is _precisely_ the "best and simplest" solution; that's why I stated it. It's "best", because it gives the most control to the user. It's "simplest", because it requires no changes to the existing language. If we were designing a language from scratch, the second point would be moot. But we're not. > > > 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 ) This is obviously the clearest; it has the most words in it. > but it still would not be as clear or as elegant as A += B. Elegant, I'll grant you. Clear, I won't. You may know what += means, but there will be more people who know what "Add ( Into=>A, Add=>B )" means. Remember, we hope to get to a place where everyone learns Ada first, and never learns C :). > In-place operations on a variables are so fundamental that they > deserves their own syntax. "deserve" implies a cost benfit ratio. You are ignoring the costs, so of course it seems like a good idea. > If you can't handle that, what kind of "programmer" are you? I can handle it, and I'm a great programmer :). -- -- Stephe