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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4bdb89c75985fc92 X-Google-Attributes: gid103376,public From: David Pando Subject: Re: recursive with Date: 1998/10/01 Message-ID: <361344FB.15A6@teisa.unican.es>#1/1 X-Deja-AN: 396627177 Content-Transfer-Encoding: 7bit References: <36126018.7619@teisa.unican.es> <361272E7.662A074@rol3.com> To: Alastair Brady Content-Type: text/plain; charset=us-ascii Organization: TEISA Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-10-01T00:00:00+00:00 List-Id: Alastair Brady wrote: > > David Pando wrote: > > > I've got an object defined in a package A with a atribute that points to > > an object defined in a package B, but this object has an atribute that > > points to the first objetc (Do I make myself clear?) > > The problem is than I can't compile the packages, because package A > > needs packege B that needs package A that... > > Is there any solution, apart from defining the objects in the same > > package > > Cyclic with's are forbidden in Ada as they prevent type checking. Its not > clear what sort of objects you are referring to... functions/procedures, > data or types. > > For functions and procdures, if you need to make a call back to the package > which you have been called from, then logically either the current operation > of the operation you wish to call exists in the wrong package. Either they > should all exist in the same package (if they are strongly related) or all > exist in separate packages. > > For types, it is common to declare a global 'types' package for types which > are common to multiple areas of the system, which is basically just a > package spec which is compiled first, and can then be with'ed by all other > packages. Similarly this can be done for global data, but strictly speaking > all data should be encapsulated and accessed using access functions > ------------------------------------------------------------------------ > Alastair Brady, Software Consultant, Do you mean C-style ? The problem is that the package were generated by CADRE, a tool that builts ADA packages from OMT graphs. Every class is encapsulated in a package named with the name of the class, and the objects of that class are of the type Instance. For example, the class foo is in the package foo, an the object is the type foo.Instance, so I can't encapsulate the related objects in the same package because the names overlap.