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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,de7dd126d6737f3a X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!138.195.8.3.MISMATCH!news.ecp.fr!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Callback in Ada (User Data argument) Date: Mon, 29 Nov 2010 19:35:52 -0600 Organization: Jacob Sparre Andersen Message-ID: References: <8lc2d0Fb6jU1@mid.individual.net> <4cf0ec67$0$6882$9b4e6d93@newsspool2.arcor-online.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1291080953 2290 69.95.181.76 (30 Nov 2010 01:35:53 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 30 Nov 2010 01:35:53 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Xref: g2news2.google.com comp.lang.ada:16677 Date: 2010-11-29T19:35:52-06:00 List-Id: "Warren" wrote in message news:Xns9E3F69D4E88CDWarrensBlatherings@188.40.43.230... ... > The problem with the "user data" argument, is that you don't > know what the user's type is going to be (in C, this is given > as a void *). The Ada dirty approach might be to use > 'System_Address, but that seems wrong. Still another approach > is to use a generic. > > Perhaps the best avenue might be to declare a base tagged > type, that the user can extend. Then the user data argument > could be the base classwide type. That is the best avenue, unless the "user data" type can be (or needs to be) part of the "root" tagged object. For instance, in Claw, we used the "user data" type in order to provide a link between the Windows handle and the Claw object. That's OK in that if you need private "user data", you can just add it to your own extension of the Claw data type. Randy.