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 05:29:09 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!easynews.net!newsfeed3.easynews.net!newsfeed.vmunix.org!news-FFM2.ecrc.net!news.iks-jena.de!not-for-mail From: Lutz Donnerhacke Newsgroups: comp.lang.ada Subject: Re: Ideas for Ada 200X Date: Tue, 3 Jun 2003 12:13:51 +0000 (UTC) Organization: IKS GmbH Jena 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> <3EDC8AA9.7000405@noplace.com> NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 1054642431 25714 217.17.192.37 (3 Jun 2003 12:13:51 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Tue, 3 Jun 2003 12:13:51 +0000 (UTC) User-Agent: slrn/0.9.7.4 (Linux) Xref: archiver1.google.com comp.lang.ada:38459 Date: 2003-06-03T12:13:51+00:00 List-Id: * Marin David Condic wrote: > Lutz Donnerhacke wrote: >> Yes, that's the Ada way. But for a lot of simple functions over simple data >> types, defining such procedures is a pain. > > A question comes to mind: Is there any reason why a compiler cannot > recognize "A := A + B;" as a special case and create an optimized > solution equivalent to "A += B;"? A second question is: If they can > detect and optimize this, are there any compilers that do so? There are compilers which detect and optimize this. > A third question is: Supposing the syntax were added - would any > compilers start generating the optimized answer? It isn't at all clear to > me that adding such syntax is going to get compilers to do a better job > than they might already be doing. The real question is not about optimizing. The real question is about readablility and clear expression. This is especially important, if X is an expression with side effects. So evaluating X twice results in different variables. This is clearly not the intent of the programmer and cause of errors, Ada is not famous for. > It might be interesting to see of Gnat generates substantially different > code for the Ada expression than it does for the C expression. Try out an iterator access to see, what's interesting here.