comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Proper program structure
Date: Thu, 1 Oct 2009 10:08:39 +0200
Date: 2009-10-01T10:07:14+02:00	[thread overview]
Message-ID: <wsvg9u3hd3xx$.1hcrqo2uxpirw$.dlg@40tude.net> (raw)
In-Reply-To: 638d582c-f275-48a9-aa2a-237f2edd123c@c37g2000yqi.googlegroups.com

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



      parent reply	other threads:[~2009-10-01  8:08 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-30 21:25 Proper program structure Maciej Sobczak
2009-09-30 22:16 ` Robert A Duff
2009-10-01  7:13   ` Maciej Sobczak
2009-09-30 23:43 ` Adam Beneschan
2009-10-01  7:35   ` Maciej Sobczak
2009-10-01  6:34 ` Brad Moore
2009-10-01  7:44   ` Maciej Sobczak
2009-10-01  9:39   ` Maciej Sobczak
2009-10-01 15:36     ` Brad Moore
2009-10-01 20:01       ` Maciej Sobczak
2009-10-02  5:44         ` Brad Moore
2009-10-02 13:10           ` Brad Moore
2009-10-01  8:08 ` Dmitry A. Kazakov [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox