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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4f4ee91990d68693,start X-Google-Attributes: gid103376,public From: okellogg@my-dejanews.com Subject: Usefulness of classwide "out" parameter Date: 1999/03/15 Message-ID: <7cikku$d4k$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 455145247 X-Http-Proxy: 1.0 x7.dejanews.com:80 (Squid/1.1.22) for client 195.243.118.226 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Mon Mar 15 09:41:51 1999 GMT Reply-To: oliver.kellogg@vs.dasa.de Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/2.0 (compatible; MSIE 3.01; Windows NT) Date: 1999-03-15T00:00:00+00:00 List-Id: Hi, Has anyone ever used a classwide subprogram parameter with mode "out" ? For example, type Mytype is tagged null record; procedure Proc (Result : out Mytype'Class); The problem I have with this is, I cannot assign another variable to the out parameter (that would change the tag, which is not possible.) Am I correct in asserting that classwide parameters of mode "out" are not terribly useful? What would a practical application of this look like? I am appending an example that shows the problem. Thanks, O. Kellogg e-mail: oliver.kellogg@vs.dasa.de -- base.ads package Base is type Mytype is tagged null record; procedure Proc (Result : out Mytype'Class); end Base; -- base-derived1.ads package Base.Derived1 is type Deriv1 is new Mytype with null record; end Base.Derived1; -- base-derived2.ads package Base.Derived2 is type Deriv2 is new Mytype with null record; end Base.Derived2; -- base.adb with Base.Derived1, Base.Derived2; package body Base is V1 : Base.Derived1.Deriv1; V2 : Base.Derived2.Deriv2; Some_Flag : Boolean := False; procedure Proc (Result : out Mytype'Class) is begin if Some_Flag then Result := V1; -- GNAT says: else Result := V2; -- dynamically tagged expression required end if; end Proc; end Base; -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own