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=unavailable autolearn_force=no version=3.4.4 Path: border1.nntp.dca3.giganews.com!border2.nntp.dca3.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!goblin3!goblin1!goblin.stu.neva.ru!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: Problem with limited with Date: Sat, 27 Jul 2013 20:21:20 +0100 Organization: A noiseless patient Spider Message-ID: References: <42dc042d-e458-42a4-abb7-23907982b88f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="d88aa8a0fafe4f7fb3eb325f8f3d97d0"; logging-data="12765"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+epkEZ6iauPydkCZ5LXgq5WnB8bbMpZt8=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:iTbRw1ZSPOnLo+rydpJkts6lmj0= sha1:wUyTEcu2Cfz9LAz+gqAyruQ5eQ0= X-Original-Bytes: 3228 Xref: number.nntp.dca.giganews.com comp.lang.ada:182724 Date: 2013-07-27T20:21:20+01:00 List-Id: Jeffrey Carter writes: > About the only thing you can do with limited with is declare access > types designating the types in the withed pkg, So of course an Ada > compiler complains if you try to do anything else. When you avoid > visible access types, you naturally avoid limited with. This is how > I've been able to work on large projects (> 1000 pkgs) without a > single limited with. I had a project of similar size, in Ada 95 - so limited with wasn't an option! (I did try the GNAT experimental versions, but each subtle variant in my code produced a new ICE). The solution was threefold: (a) each class (this was code-generated from a UML model using a Shlaer-Mellor OOA profile) declares a type Instance derived from a base type (b) associations (what you would need the limited with for) are implemented by appropriate access components in the Instance record (they aren't private, but you're not supposed to use them) (c) associations between two classes are managed using a third package. If the House_Management model says Association A1: each Button Controls one-or-more Lamps each Lamp Is_Controlled_By one-or-more Buttons the generated code will include with House_Management.Lamp.Collections; with House_Management.Button.Collections; with House_Management.Button_To_Lamp.Collections; private package House_Management.A1 is function Link (Controls : Lamp.Handle; Is_Controlled_By : Button.Handle) return Button_To_Lamp.Handle; [...] procedure Unlink (Button_To_Lamp_Handle : Button_To_Lamp.Handle); [...] function Controls (A_Lamp : Lamp.Handle) return Button.Collections.Collection; [...] function Is_Controlled_By (A_Button : Button.Handle) return Lamp.Collections.Collection;