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.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no 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!news3.google.com!feeder.news-service.com!85.214.198.2.MISMATCH!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Warren Newsgroups: comp.lang.ada Subject: Re: Callback in Ada (User Data argument) Date: Tue, 30 Nov 2010 16:51:14 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <8lc2d0Fb6jU1@mid.individual.net> <4cf0ec67$0$6882$9b4e6d93@newsspool2.arcor-online.net> Injection-Date: Tue, 30 Nov 2010 16:51:14 +0000 (UTC) Injection-Info: mx01.eternal-september.org; posting-host="9f8M0iN5t54V+4DF/iqO8g"; logging-data="21289"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/86cpnMA4wuk26CpYJ9frpGLnB6wuPRbw=" User-Agent: Xnews/5.04.25 X-Face: &6@]C2>ZS=NM|HE-^zWuryN#Z/2_.s9E|G&~DRi|sav9{E}XQJb*\_>=a5"q]\%A;5}LKP][1mA{gZ,Q!j Cancel-Lock: sha1:6dyp0OupuGeGQc3ZsANrFdkJtsI= Xref: g2news2.google.com comp.lang.ada:16683 Date: 2010-11-30T16:51:14+00:00 List-Id: Randy Brukardt expounded in news:id1kdp$27i$1@munin.nbi.dk: > "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. I see what you mean. Yep, I like that. Warren