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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e5eb8ca5dcea2827 X-Google-Attributes: gid103376,public From: Matthew Heaney Subject: Re: Ada OO Mechanism Date: 1999/06/08 Message-ID: #1/1 X-Deja-AN: 486875515 References: <7i05aq$rgl$1@news.orbitworld.net> <7i17gj$1u1k@news2.newsguy.com> <7icgkg$k4q$1@nnrp1.deja.com> <3749E9EC.2842436A@aasaa.ofe.org> <7id2eo$fag@drn.newsguy.com> <3749FF7D.F17CE16A@aasaa.ofe.org> <374AC676.F7AE0772@lmco.com> <7ieuja$5v9@news1.newsguy.com> <7ifd6l$bmf@sjx-ixn1.ix.netcom.com> <7ihf6i$4hv@dfw-ixnews10.ix.netcom.com> NNTP-Posting-Date: Mon, 07 Jun 1999 17:38:59 PDT Newsgroups: comp.lang.ada Date: 1999-06-08T00:00:00+00:00 List-Id: On 07 Jun 1999 15:26:52 -0400, Hyman Rosen wrote: > Matthew Heaney writes: > > No. The compiler has no way of knowing at compile-time how much space > > to allocate on the stack for the return value of the function. The size > > is determined at run-time. > > From a little further fooling around, followed by a trip to the Ada RM, > I see that objects of class-wide type can not be record components, which > I guess makes sense, but it doesn't seem very orthogonal to me. I'm not sure what you mean by "doesn't seem very orthogal," but there are pragmatic reasons for not allowing a class-wide type as a record component. Just as the record decl type RT is record S : String; end record; is illegal, so is the decl type RT is record O : T'Class; end record; However, the declaration declare S : String := Func_Return_String; begin is perfectly legal, and so is the declaration declare O : T'Class := Func_Return_T_Tic_Class; begin In neither case is heap required.