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: Robert A Duff Subject: Re: Ada OO Mechanism Date: 1999/06/14 Message-ID: #1/1 X-Deja-AN: 489520007 Sender: bobduff@world.std.com (Robert A Duff) References: <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> <1999Jun8.151014.1@eisner> <375D9A3D.E1CCCC63@averstar.com> < <375E92CB.27850620@averstar.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 1999-06-14T00:00:00+00:00 List-Id: Brian Rogoff writes: > Yes, I know. I can understand why it makes sense that a record cannot > contain unconstrained types, but I don't understand why a suitable > generalization of Ada's ability to return unconstrained types could not be > made to solve the problem being discussed *without* forcing a heap based > mechanism on Ada. An example might be returning two strings on the stack. Well, you can return two strings on the stack by returning a record that looks like this: type String_Pair(Length1, Length2: natural) is record String1: String(1..Length1); String2: String(1..Length2); end record; But you can't do that with class-wide, because there's no constraint to constrain the tag of an object, analogous to the constraints on the upper bounds of the above strings. Adding such a concept to the language would add functionality, but would also add complexity. Probably not worth it. - Bob -- Change robert to bob to get my real email address. Sorry.