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-Thread: 103376,1888e8caa20a2f2d X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Controlled types and exception safety References: <8sKdnXNeIZMxIg3eRVn-ig@comcast.com> <3trncoj4t0va.19bs46zhm4xbe.dlg@40tude.net> <2Rklf.171$n1.114@newsread2.news.pas.earthlink.net> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Thu, 08 Dec 2005 19:37:01 GMT NNTP-Posting-Host: 67.3.225.125 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.pas.earthlink.net 1134070621 67.3.225.125 (Thu, 08 Dec 2005 11:37:01 PST) NNTP-Posting-Date: Thu, 08 Dec 2005 11:37:01 PST Xref: g2news1.google.com comp.lang.ada:6778 Date: 2005-12-08T19:37:01+00:00 List-Id: Randy Brukardt wrote: > Now, how is this assignment performed if we're using the default assignment > here? Since we need to component, we need to call the Assign procedure on > the component C, but what left-hand side to pass as To? There isn't a > component O.C in the left-hand side! I guess I'm still missing something. Default assignment to a record with discriminants, or at least that changes the discriminants, invoking 'Assign for a component, would assign to an intermediate with the correct discriminants, which is then copied into the target as is currently done. Working out the rules is probably complicated, and hardly worth the effort since Ada uses another mechanism, but I'm still not convinced it couldn't be done. Probably because IANALL and I'm missing something. > Maybe Ada 200Y limited types and Assign procedures would be adequate, but > certainly not the Ada 95 variety. Ada 95 limited types don't allow (1) > aggregates; (2) constants; (3) useful functions; or (4) any sort of complex > initialization. Which means that you can't use many of the techniques that > help reduce bugs in Ada (such as letting the compiler check that all > components have been given in an aggregate). And limited types also block > most optimizations by their very nature. That's useful in some cases, but in > others you'd rather let the compiler eliminate extra temporaries and > Finalizes. (That's allowed for non-limited types, but never for limited > types.) I've always felt that preventing the use of aggregates was an important part of limited types. Constants don't seem like a problem, since they can be implemented as functions. You can pass function results to the From parameter of Assign. Complex default initialization requires some work, but I was able to do some pretty complex default initialization using functions as default initial values in Ada 83. Preventing user-defined initialization seems like an important part of limited types. -- Jeff Carter "Why don't you bore a hole in yourself and let the sap run out?" Horse Feathers 49