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,6fb0eff797e41c12,start X-Google-Attributes: gid103376,public From: Matthias Oltmanns Subject: Dynamic Instantiation in Ada95 ? Date: 1998/04/15 Message-ID: <01BD6867.17421990.Matthias.Oltmanns@so.sema.de>#1/1 X-Deja-AN: 344287909 Sender: Ada programming language Content-Transfer-Encoding: 7bit Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU Content-Type: text/plain; charset="us-ascii" Organization: SEMA GROUP GmbH MIME-Version: 1.0 Reply-To: "Matthias.Oltmanns@so.sema.de" Newsgroups: comp.lang.ada Date: 1998-04-15T00:00:00+00:00 List-Id: Hi all, I would like to implement a kind of runtime instantiation for class-wide types, where the concrete type is not known at compile time. I've searched for a method in exact that way as S'Class'Input is working. S'Class'Input first reads the external tag name from a stream and than makes a dispatching call to the appropriate S'Input method. Example: ... type Base is tagged with null record; function Create return Base; -- function Create_Dynamic (Tag_Name : String) return Base'Class; ... << Some type-extensions for the type Base >> ... I would like to implement the function as follows: function Create_Dynamic (Tag_Name : String) return Base'Class is T : Ada.Tags.Tag := Ada.Tags.Internal_Tag (Tag_Name); begin return <>; end Create_Dynamic; Is there a way to do that? I've found only some dirty hacks, using unchecked_deallocation , for T'Address use ... and so on. I'am interresting for a more portable approach. Any suggestions? Matthias Oltmanns, Email: Matthias.Oltmanns@so.sema.de, Phone: +49 4421 802 207, Fax: +49 4421 802 444, SEMA GROUP GmbH Wilhelmshaven (Germany) - Special Systems Division -