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,d2f0af5e440b367f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-02 22:11:25 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cyclone.bc.net!sjc70.webusenet.com!news.webusenet.com!sn-xit-02!sn-xit-04!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: proposal for new assignment operators Date: Thu, 3 Jul 2003 00:12:19 -0500 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3EF9CD5F.6030608@cogeco.ca> <3doRhIgUmUYX@eisner.encompasserve.org> <3F038B77.2F2E41B7@adaworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Newsreader: Microsoft Outlook Express 4.72.3612.1700 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3719.2500 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:40002 Date: 2003-07-03T00:12:19-05:00 List-Id: Hyman Rosen wrote in message ... >I looked at the section on Controlled types (7.4) in the Rationale and >didn't see any discussion about this, except for a remark about returning >limited types from functions. This leads me to believe that the "lot of >very good reasons" have to do with technical aspects of preserving >existing parts of Ada rather than abstract notions of how assignment >should be done properly. Not that there's anything wrong with that. Sometimes Ada zealots (myself included) overstate the case. We get so used to explaining something that it starts seeming like a good thing. The truth is, Adjust was a kludge of sorts that came about for a number of reasons. It was born of expediency. Ada 9x originally had a full-blown constructor/destructor/user-defined assignment solution. However, it is was very complicated, because assignments occur in many contexts other than assignment statements (and only covering assignment statements would make it impossible to make a complete abstraction), because of "disappearing" components (it is not always the case that a component in the source also exists in the target - which makes proper composition a nightmare), and because it was orthogonal to everything else in the language. When the Distinguished Reviewers decided it was necessary to cut proposed features (the infamous "scope reduction"), that was one of the features that was cut. A few of us (especially me) continued to push for some finalization solution, because it is a critical capability present in many other programming languages. Eventually, Tucker and his team proposed a much lighter-weight solution using tagged types: the Controlled types that we know and love. This solution had a variety of nice properties: It didn't need a lot of special rules (or implementation), because the tagged type rules eliminated a lot of problems, and the implementation can be the same. It composes automatically; because the handling of the source and target in an assignment are separate, disappearing components are not a problem. But it still is 3/4s of a loaf. That's a lot better than no loaf (which was the only option politically), but it still isn't an ideal solution. We have the problem that it cannot be added to an existing type (I personally don't consider that much of a problem, since there are few types of any complexity that don't need to be controlled). And there isn't any way to allow assignments between subtypes with different discriminants or bounds (since those checks are always performed in the standard way). Perhaps interfaces will aleviate these problems. If Ada 95 had been defined from scratch, it probably would not have had the existing issues that made Finalization/user-defined assignment so hard. But of course Ada 95 had to be mostly compatible with Ada 83 (as Ada 2005 will have to be mostly compatible with Ada 95), so we didn't have the blank sheet of paper to start from. Randy.