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-05-30 09:25:00 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: 30 May 2003 12:08:56 -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> <1138545.LxB10ZPFul@linux1.krischik.com> <12407013.TRm0SXE9Zq@linux1.krischik.com> NNTP-Posting-Host: anarres.gsfc.nasa.gov Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 1054311899 3838 128.183.235.92 (30 May 2003 16:24:59 GMT) X-Complaints-To: usenet@news.gsfc.nasa.gov NNTP-Posting-Date: 30 May 2003 16:24:59 GMT User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 Xref: archiver1.google.com comp.lang.ada:38114 Date: 2003-05-30T16:24:59+00:00 List-Id: "Dmitry A. Kazakov" writes: > I am not so sure that a compiler would be capable to optimize each > possible case of X := X @ Y. Especially if all operations in the > expression are user-defined and types are controlled. > > On the other hand, very often in C++ to implement all that ++, +=, > *= etc + by value vs. by reference variations becomes a heavy burden > when an abstract type is defined. It is also difficult to ensure > that the semantics of all operations is compatible. Exactly. If you can't expect a compiler to get it right, why would you expect a programmer to get it right? Clearly for scalar types (reals, integers, enumerations), Foo_type'Inc(by : in Foo_type) is simple to define and implement; not that different from 'Succ. That would be a trivial addition to the language, and I'd like to see it (if only to end this thread :). But for user-defined component types (records, protected, array types), the semantics can get too complex. What would Array_Type'Inc (By : in Array_Type) mean? "Add By to each element" comes to mind, but that's probably not very useful. Users can always write their own Inc function, anyway, so there is no need to allow user-defined 'Inc. -- -- Stephe