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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,efde8669839c1c0a X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!feeder1-2.proxad.net!proxad.net!feeder2-2.proxad.net!newsfeed.arcor.de!newsspool4.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Proper program structure Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <638d582c-f275-48a9-aa2a-237f2edd123c@c37g2000yqi.googlegroups.com> Date: Thu, 1 Oct 2009 10:08:39 +0200 Message-ID: NNTP-Posting-Date: 01 Oct 2009 10:07:14 CEST NNTP-Posting-Host: db4ad890.newsspool4.arcor-online.net X-Trace: DXC=NMhNG`\19M_AX0F2i>kgR4Xj_Okk>=H^ X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:8556 Date: 2009-10-01T10:07:14+02:00 List-Id: On Wed, 30 Sep 2009 14:25:57 -0700 (PDT), Maciej Sobczak wrote: > 2. Defining them in non-child packages means that they cannot see the > complete structure of the Car and therefore they cannot be "wired" by > discriminants like here: > > -- wrong: > type Car is limited record > Body : Body_Type (Car'Access); > Engine : Engire_Type (Car'Access); > -- and so on They could with MI type Engine_Interface is limited interface; --- type Gear_Box_Interface is limited interface; --- type Engine_Type ( Gear_Box : not null access Gear_Box_Interface'Class ) is new Engine_Interface with ... --- type Gear_Box_Type is new Engine_Interface with ... --- type Car is new Ada.Finalization.Limited_Controlled and Engine_Interface and Gear_Box_Interface with private; private type Car is new Ada.Finalization.Limited_Controlled and Engine_Interface and Gear_Box_Interface with record Engine : Engine_Type (Car'Access); Gear_Box : Gear_Box_Type; end record; > Am I over-sensitive or did I really hit a design problem? Yep, any design will ultimately collapse into dynamically typed mess on further constraints like the engines of the class E_123'Class require gear boxes from the class G_M25_X'Class. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de