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,acb50cdf95d3e13c X-Google-Attributes: gid103376,public From: jsa@alexandria (Jon S Anthony) Subject: Re: Extending A Generic Signature Package Date: 1997/03/25 Message-ID: #1/1 X-Deja-AN: 228109980 Distribution: world References: <5gkv23INN3rn@thalamus.cis.ohio-state.edu> 21: 34:40 -0500 Organization: PSI Public Usenet Link Newsgroups: comp.lang.ada Date: 1997-03-25T00:00:00+00:00 List-Id: In article <5gvgg0INNj32@snoopy.cis.ohio-state.edu> dgibson@snoopy.cis.ohio-state.edu (david scott gibson) writes: > In article , > Jon S Anthony wrote: > > >> > declare > >> > X : Base'Class := Get_Object; > >> > begin > >> > Op1(X); > >> > end; > >> > >> So in this case it's clear to us and the compiler what specific type > >> derived from Base Get_Object returns. > > > >No, the _specific_ type is unknown until runtime. But, whatever it > >is, it will be in Base'Class. > > Hmmm. I was thinking of Get_Object as a constructor for a specific > derived type of Base. Are you're suggesting some non-functional > behavior here for Get_Object to be able to return any one of several > specific derived types? I don't know what you mean by "non-functional behavior". Certainly, as you suggest, Get_Object could be a constructor for a specific type in Base'Class, but I was thinking of a different situation. Suppose it returns Base'Class and computes the object of the appropriate specific type on the fly. Or perhaps, it dispatches (in which case it needs a parameter of some sort) to the appropriate specific Get_Object or some combination of these. Anyway, you get the idea. > that this rule only applied to them. Nevertheless, I assume compilers > may return tagged types, especially big ones, by reference. I didn't > mean to imply that objects passed by reference should be thought of as > "pointers". Ada seems to do a good job of making the mechanism > transparent. Bob answered this one. /Jon -- Jon Anthony Organon Motives, Inc. Belmont, MA 02178 617.484.3383 jsa@organon.com