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,740e91341085efe3 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 08 Apr 2005 17:20:01 -0500 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Some help for a C++ guy References: <1112993665.945046.278360@f14g2000cwb.googlegroups.com> X-Newsreader: Tom's custom newsreader Message-ID: Date: Fri, 08 Apr 2005 17:20:01 -0500 NNTP-Posting-Host: 67.161.24.234 X-Trace: sv3-0y8zMRbu/s9pA4l9v+BrQE7cqx/+Jy2m12wgNSq/3rTL5XWoeWMK3bAt06tfJEKW2ITBxbfXitHYDOY!9zGbITeLE1X9FAy6A5I0NLNeUPNY0WFz4AYeOBeqLs4Ru6T9FHJ2F7FgnjYkFg== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.31 Xref: g2news1.google.com comp.lang.ada:10356 Date: 2005-04-08T17:20:01-05:00 List-Id: >That's a problem because that callback subroutine needs to be passed to >a function expecting some of the type BC_Completion_Handler_T, defined >as: > > type BC_Completion_Handler_T is access > procedure (Status : in IO_Status_T); > >Changing the that type would then break a bunch of other code. So you need to specify for a callback the particular Message_* that it pertains to? Just make a set of wrapper routines: procedure Message_0_Completion_Handler(Status : in IO_Status_T) is begin Completion_Handler(Message(0), Status); end Message_0_Completion_Handler; etc. and register the specific Message_*_Completion_Handler procedures. I presume this registration is done once so even if you add a new Message_237_Completion_Handler it's a minor addition to a single package. I'm presuming you want to make small changes to the existing code. If you want to use tagged types you are contemplating larger architectural changes. In your current code, "registering a callback" means essentially "note a particular routine, and a particular Message_n's data for future use". Passing an explicit tagged Handler parameter accomplishes the "note a particular Message_n's data" part. If the particular routine is not in fact dynamic, but always BC_Completion_Handler, then instead of registering the procedure callback you want to register the Message_n data and always call BC_Completion_Handler(Registered_Message, Status);