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-03 09:44:16 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsswitch.lcs.mit.edu!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X Date: 03 Jun 2003 12:44:15 -0400 Organization: The World Public Access UNIX, Brookline, MA 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> <6vWcnTWjF83bD0qjXTWcpA@gbronline.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1054658655 2057 199.172.62.241 (3 Jun 2003 16:44:15 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Tue, 3 Jun 2003 16:44:15 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: archiver1.google.com comp.lang.ada:38510 Date: 2003-06-03T12:44:15-04:00 List-Id: Bill Findlay writes: > As I see it there are several arguments in favour of the 'idem' proposal: > > 1. It lets the programmer indicate that the occurrences of the LHS in the > RHS are *necessarily* the same, and not contingently so, which makes the > code more self-documenting. > > 2. It removes a source of error in transcribing the LHS multiple times. > > 3. It allows more concisely readable code when the LHS is lengthy. > > 4. It provides functionality that it only partially available by means of > much clumsier renaming declarations, because not all objects can be renamed. > > 5. It requires the compiler to evaluate the lvalue of the LHS once and reuse > that lvalue as often as needed to evaluate the RHS. This has three potential > benefits: shorter code, faster execution, and once-only invocation of any > side effects. > > 6. It might make it somewhat easier for the compiler to generate > update-in-place object code, where the target architecture allows that and > where it offers a performance advantage. > > 7. It provides all the utility of C's multitude of combined assignment > operators with one small, compatible change to the syntax of operands. > (I specify C, rather than C++, to avoid getting into a argument about > overloading assignment). > > 8. It allows the expression of useful forms that C's combined assignment > operators cannot achieve (e.g. X := 1 - idem;). Well said. Number 6 applies only if there are non-inlined calls involved. They presumably don't normally have side effects (because that would usually be wrong), but the compiler doesn't *know* that. That is, currently the compiler can avoid evaluating X twice in "X := X + 1;" only if "X" contains no out-of-line function calls. Number 5 doesn't say anything that 1 and 6 don't say. Anyway, I doubt if this feature will make it into any future version of Ada. It's just not important enough. But it's fun talking about it... > -- > Bill-Findlay chez blue-yonder.co.uk ("-" => "") > > BTW I would like to emphasize that I am not wedded to the concrete syntax of > 'idem', '<>', 'all' or whatever - I regard that as a minor matter to be > determined, and hope that aesthetic preferences do not cloud the wider > issue. - Bob