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,487310d7e1471eac X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!k79g2000hse.googlegroups.com!not-for-mail From: george@gentoo.org Newsgroups: comp.lang.ada Subject: Re: parent package referring to child Date: Thu, 11 Oct 2007 02:45:36 -0700 Organization: http://groups.google.com Message-ID: <1192095936.309410.62410@k79g2000hse.googlegroups.com> References: <1191997397.865251.322480@d55g2000hsg.googlegroups.com> NNTP-Posting-Host: 129.194.8.73 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1192095936 7643 127.0.0.1 (11 Oct 2007 09:45:36 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 11 Oct 2007 09:45:36 +0000 (UTC) In-Reply-To: <1191997397.865251.322480@d55g2000hsg.googlegroups.com> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux x86_64; en_US, uk, fr, de, ru; rv:1.7.3) Gecko/20040916,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: k79g2000hse.googlegroups.com; posting-host=129.194.8.73; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Xref: g2news2.google.com comp.lang.ada:2428 Date: 2007-10-11T02:45:36-07:00 List-Id: eliben wrote: > I have a package FOO that encapsulates a large part of the system. Now [..] > Is there any way to overcome this problem ? Perhaps a different design > that suits the requirement and doesn't go against the Ada standard ? I have been faced with just such a problem, when writing a library to access abf files (a special data format used by the most common software in electrophysiology). I needed to define a record type with near a thousand fields (beat you here ;)) and did not want to put it all into the single spec. My solutions was exactly redesign, or rather I designed it from ground up to be appropriately split between the parent and child modules. On top there was ABF with the most common (elementary) types. Then there were children. ABF.Header to keep the big struct and IO ops specific to the header part. ABF.Data, ABF.Synth, etc (some with further children) for dealing with the corresponding parts of data file (it can have one of a few modes each of which imposed a somewhat different layout of the data). All children would naturally see ABF and most would with the ABF.Header, as necessary. In the further development (this one not finished actually) I even split that big struct off into a private child with the intention of creating a somewhat "thicker" "binding" (to the data layout). You may try playing with Ada-2005 features, as others suggested, but that seems to require making the corresponding type tagged. Plus, in the long run and for a non-trivial problem, it may be well worth splitting or designing the split early in the process. Of course it is up to you to know best, what is the appropriate way (for example, if the overall structure of the project is expected to be plain and not extensible it may be better to try to make limited with do what you need instead). George