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,a3f460aaba1863e2 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.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Tue, 19 Jul 2005 18:16:40 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1120752411.808598.292980@g49g2000cwa.googlegroups.com> <1121269243.013754.57720@g14g2000cwa.googlegroups.com> Subject: Re: Private primitive operations available to entire package hierarchy. Can it be done? Date: Tue, 19 Jul 2005 18:19:47 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4952.2800 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4952.2800 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-aYBa55o/bXmVdAj8UL4jmeMpFIO+Lf7LH4JEVrkNUQLqF9WebRFLnKWx0Xs7yb6rGEuilkr5KvPPtDk!y9fwVWa1T/KIIW9HuDY0Cw549rOqpMOw/zZCqEQ3DWa1TH2mx7YYSFhs21ua31GXswqHWOC2Go01 X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.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.32 Xref: g2news1.google.com comp.lang.ada:3681 Date: 2005-07-19T18:19:47-05:00 List-Id: "Lucretia" wrote in message news:1121269243.013754.57720@g14g2000cwa.googlegroups.com... > Although the factory that creates an Ada type from a C++ wxWidgets > class name would possibly be ok in the private part of the root package > (wx). Putting all the other primitives I need to be private from > outside of (wx) in the root package isn't possible due to the fact that > the root package (wx) doesn't know about types that those functions may > need (wx.Window.Window_Type). i.e. I have another function which > creates the correct window type from an access type which comes from > the C side of the code, thus it's got an unknown type until it comes > out of this function. This is a problem, and one I have no clue how to > fix. These things don't sound very primitive to me. If they don't need to be dispatching, put them into the private part of the child packages. Another possibility is to invert the structure, and put them into private child packages of the root, along with a derived type (not intended to be used externally). Then derive from that hidden type in a public child. (This also would seem to require Ada 200Y features, but one that is available in the newest GNATs). This would look like: package Root is type Root_Type is tagged ... procedure Root_Operation (Obj : in out Root_Operation; ...) is abstract; end Root; private package Root.Private_Child is type Private_Version_of_Type is new Root_Type with ... procedure Private_Operation_1 (Obj : in out Private_Version_of_Type; ...); procedure Will_be_Public_Operation (Obj : in out Private_Version_of_Type; ...); procedure Root_Operation (Obj : in out Private_Version_of_Type; ...); end Root_Private_Child; private with Root.Private_Child; -- Ada 200Y package Root.Public_Child is type Public_Type is new Root_Type with private; procedure Public_Operation (Obj : in out Public_Type; ...); -- Root_Operation is inherited, and the version in Private_Child will be called when it -- is referenced or dispatched to. The other two operations are *not* publically inherited. private type Public_Type is new Root.Private_Child.Private_Version_of_Type with ...; -- The other two operations are inherited here. procedure Public_Operation (Obj : in out Public_Type; ...) renames Will_be_Public_Operation; -- Connect the visible Public_Operation with Will_be_Public_Operation. end Root.Public_Child; If this doesn't work, then the structure of the system is just too convoluted. (Which I realize is out of your control.) > I'm not too sure I understand what you mean with respect to the > registration packages. I've had to include the factory in wx.Object > package as the registration package has to return a type of > Object_Class and the Object also has to register itself although, I > could possibly change that), thus cyclic dependency! I don't think it is necessary to register the Object type itself, especially as it will be abstract in the vast majority of systems. (Thus, there are no objects.) Even if you do have to, you can special case that and do it at the point of the registration package (clearly it knows about the type "Object"). Hope this helps. Randy.