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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f51e93dacd9c7fca X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-22 04:18:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsfeed.belnet.be!news.belnet.be!luth.se!fu-berlin.de!uni-berlin.de!dialin-145-254-038-188.arcor-ip.NET!not-for-mail From: Dmitry A.Kazakov Newsgroups: comp.lang.ada Subject: Re: status of Ada STL? Date: Sun, 23 Jun 2002 01:23:53 +0200 Message-ID: References: <4006huok6mmo59d3lmkvqt3ffpccu0c2d6@4ax.com> <3D135A61.F0CDAE33@attbi.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: dialin-145-254-038-188.arcor-ip.net (145.254.38.188) Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: fu-berlin.de 1024744715 11423926 145.254.38.188 (16 [77047]) User-Agent: KNode/0.4 Xref: archiver1.google.com comp.lang.ada:26594 Date: 2002-06-23T01:23:53+02:00 List-Id: Mark Biggar wrote: > "Dmitry A. Kazakov" wrote: >> >> procedure '':=" (Target : in out A; Source : A); -- (*) >> >> Note I do not demand that the copy constructor would be derived from >> ":=". It is IMO a wrong idea to attempt to derive one from another. >> C++ does it simplier. What is actually wrong in C++ is that the result >> of "=" is not void. >> >> >Wouldn't it also fall apart if we started including "+:="? >> >> No, they should be just user-defined procedures. Whether they are >> primitive or not should only depend on the freezing rules and whether >> particular parameters are class-wide. >> >> (*) There is a minor problem with unconstrained subtypes passed as >> inout and that discriminants cannot be changed. > > There are other problems as well. This was looked at in detail during > the Ada95 revision. Allowing users to redefine ":=" using a procedure > definition like that above was determine to be way too course grained. > Do you expect your new assignment operation to compose for record or > array types? What about variable initialization? This should be performed by a copy-constructor. The user may influence it by overriding Adjust which is a part of it. Compiler should never use ":=" implicitly. > Or, the assign out > during procedure exit for out parameters? Out parameters are now allowed to be read, so it is no more a problem. A similar problem (though with all predefined operations) is that people might want to get rid of predefined ":=" and have procedure '':=" (Target : in out A; Source : A'Class); This is unsolvable, because there is no way to disallow a primitive operation in Ada. > This is way ada95 controlled types are tagged and break the assignment > process down into finer parts with Initialize, Adjust and Finalize > as user definable hooks into a larger assignment process. This way > use defines the type specific parts of data movement and the compiler > is free to use them in various ways to move data around in ways the > guarantees that the type's data abstractions are preserved. This is IMO bad. Assignment should be just a user-defined procedure. It could be well defined as Finalize + Copy-constructor, but no longer user overrides it. -- Regards, Dmitry Kazakov www.dmitry-kazakov.de