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,dbcfe2b0a74da57e X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!news.germany.com!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Inherited Methods and such Date: Tue, 25 Sep 2007 16:02:55 -0500 Organization: Jacob's private Usenet server Message-ID: References: <1190039166.449906.15070@g4g2000hsf.googlegroups.com> <1190041908.492024.263110@19g2000hsx.googlegroups.com> <1190060534.958182.51800@d55g2000hsg.googlegroups.com> <87tzptuhku.fsf@ludovic-brenta.org> <1190125656.071013.303640@22g2000hsm.googlegroups.com> <1ds7l1l7oeyrx.1cpsvrpkikour.dlg@40tude.net> <1190147965.676457.123000@d55g2000hsg.googlegroups.com> <1co37tau98gct.axsglmqh0xu9$.dlg@40tude.net> <1190213376.707449.146640@g4g2000hsf.googlegroups.com> <1fl2wnziigxfd.1fjbag2hh8sbc$.dlg@40tude.net> <1190239986.762473.204290@k79g2000hse.googlegroups.com> <1rw45b3rmvmcr$.1df4wst5oknbl$.dlg@40tude.net> <1190296353.624737.150940@y42g2000hsy.googlegroups.com> <11m13st1f92kf$.m8s6y8mc8ebk.dlg@40tude.net> <1190321119.206313.65290@57g2000hsv.googlegroups.com> <1190408526.100291.265040@50g2000hsm.googlegroups.com> <9ukf2wtqjs0q$.iuijmal4x56b$.dlg@40tude.net> <19ie8rfpiitdx$.i2sz3r6uj66w.dlg@40tude.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1190754003 10649 69.95.181.76 (25 Sep 2007 21:00:03 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 25 Sep 2007 21:00:03 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1896 Xref: g2news2.google.com comp.lang.ada:2131 Date: 2007-09-25T16:02:55-05:00 List-Id: "Dmitry A. Kazakov" wrote in message news:19ie8rfpiitdx$.i2sz3r6uj66w.dlg@40tude.net... > On Mon, 24 Sep 2007 20:59:53 -0500, Randy Brukardt wrote: > ... > > Ada has no choice. You agree that "magic" is needed to do the memory > > allocation, layout, etc. for the underlying object. (To say otherwise would > > be to require all objects to be fixed in size.) But that is not divisible > > from the initialization of the value in Ada (and the values of the > > components), because the memory allocation depends on the value of the > > discriminants, and even the components that exist depends on those values. > > It can be made divisible: > > For each type T we define a plain built-in record type T'Constraints such > that it has all the constraints (discriminants, bounds, tags) of T. Prior > allocation of T a user hook is called to return T'Constrants. It gets the > parameters of the constructor. Then the memory is allocated. After that the > implementation type of T is constructed (the constraints are set, the > components are constructed). Then we proceed to the construction of T. Here > the parent types are constructed first and finally a user hook equivalent > to Initialize is called on T. For class-wide types there is an additional > step where the class-wide user hook is called. That's what I tried to do with Janus/Ada, and it doesn't work in all cases. I don't have a specific example to give, but the problem comes from the required order of evaluation; we were reading uninitialized values in obscure cases. I couldn't find anyway around those requirements. > > Note that this is very similar to the reasons that Ada cannot have "real" > > user-defined assignment; it's not possible to divide an assignment into > > components managed separately. > > Same as above. Moreover it would be probably possible to make the old LHS > visible in the hook computing the constraints. No, you can't have visibility on both objects in a hook routine, because there are cases where one side or the other does not exist. You have to define three sets of hooks, which would greatly increase the chance of errors and probably would be too complex for most to understand. The problem doesn't exist if your language doesn't have disappearing components, and I would be much more likely to try to approach the problem from there. But that wouldn't be Ada. Randy.