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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,18684ed750c9b60f X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.181.12.101 with SMTP id ep5mr18729wid.1.1349940892114; Thu, 11 Oct 2012 00:34:52 -0700 (PDT) Path: q10ni65082153wif.0!nntp.google.com!feeder2.cambriumusenet.nl!feed.tweaknews.nl!85.12.40.130.MISMATCH!xlned.com!feeder1.xlned.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!border4.nntp.ams.giganews.com!border2.nntp.ams.giganews.com!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!backlog1.nntp.dca.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.glorb.com!aioe.org!.POSTED!not-for-mail From: "Dmitry A. Kazakov" Newsgroups: comp.lang.ada Subject: Re: How to get generic formal parameter type into base class Date: Sun, 7 Oct 2012 09:42:47 +0200 Organization: cbb software GmbH Message-ID: References: <51f8461d-d362-4e5f-a188-ac96a699a211@googlegroups.com> <527f8487-a578-406c-86c3-b3b0596cda71@l32g2000yqb.googlegroups.com> Reply-To: mailbox@dmitry-kazakov.de NNTP-Posting-Host: 9A8bJrx4NhDLcSmbrb6AdA.user.speranza.aioe.org Mime-Version: 1.0 X-Complaints-To: abuse@aioe.org User-Agent: 40tude_Dialog/2.0.15.1 X-Notice: Filtered by postfilter v. 0.8.2 X-Original-Bytes: 2442 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Date: 2012-10-07T09:42:47+02:00 List-Id: On Sat, 6 Oct 2012 13:03:34 -0700 (PDT), kevin andrew wrote: > I still don't see how to get a dynamic type into base class so that I > can dispatch to a function with that type in the function signature. > If I do a Root_Type then I don't see how I can include the Get/ > Set_Value function because Data_Type is unknown? Any help getting my > ignorant mine understanding Ada will be greatly appreciated. I have > included a better Main procedure which more accurately shows what I am > trying to do. [...] Why do you need Get_Values? If there will be a specific descendant type of Xate_Base_Type for each scalar value type, that will have a Get_Value of its own. And in any case, passing type ID to Get_Values does not make much sense because the instance of Xate_Base_Type already "knows" its scalar counterpart. Since scalar types do not belong to the same hierarchy of types, not tagged, and full double dispatch is not supported anyway, adding Decode on top of Get_Values does not change anything. You still need to pass a specific type of the Value into it. So either you have a distinct operation per scalar type defined at the root or you use some container type capable to hold instances of them. E.g. a stream, a variant record type etc. P.S. You don't need generics for this case unless you have many different scalar types of same origin to support, e.g. integer types of various sizes. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de