comp.lang.ada
 help / color / mirror / Atom feed
From: AdaMagica <christ-usch.grein@t-online.de>
Cc: mailbox@dmitry-kazakov.de
Subject: Re: Ada 2005 puzzle
Date: Sat, 28 Jul 2012 02:48:43 -0700 (PDT)
Date: 2012-07-28T02:48:43-07:00	[thread overview]
Message-ID: <a43a3b4b-efeb-475f-9c5d-d19232c91c1c@googlegroups.com> (raw)
In-Reply-To: <1x51ztmeo2hll.jtsosl0kzzhi.dlg@40tude.net>

On Friday, July 27, 2012 3:04:12 PM UTC+2, Dmitry A. Kazakov wrote:
> If you cannot derive? Primitive operations make little sense if there is
> only one type.
>
> Abstract types fall short either because you could not have:
>
>    type T is abstract ... with private;
>    function Create (...) return T; -- Non-abstract
>       -- initializes private parts of T, called from the overriding
>
> The stuff just does not make any sense to me.

I see what you mean. But since no objects of abstract types may exist and somehow you have to provide the private components of derived nonprivate objects, the proper Ada way (as intended by ARG, I guess) is child packages. They can see the private part and provide the necessary information. (I'm sure you know this.)
So you *can* derive:

package Root is
  type T is abstract tagged private;
private
  ...
end Root;
package Root.Child is  -- body can see private part of Root
  type S is new T with private;
  function Create (...) return S;
private
  ...
end Root.Child;

-- I guess that's what you want:
with Root;
package Derived is  -- this does not work, there's no way to provide the
                    -- private part of T.
  type S is new Root.T with private;
  function Create (...) return S;



  reply	other threads:[~2012-07-28  9:50 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-12 12:54 Ada 2005 puzzle Dmitry A. Kazakov
2012-07-12 15:48 ` Adam Beneschan
2012-07-12 16:34   ` Dmitry A. Kazakov
2012-07-19  6:53     ` Randy Brukardt
2012-07-19  7:55       ` Dmitry A. Kazakov
2012-07-20  2:22         ` Randy Brukardt
2012-07-20  7:20           ` Dmitry A. Kazakov
2012-07-21  0:04             ` Randy Brukardt
2012-07-21  8:34               ` Dmitry A. Kazakov
2012-07-24  2:38                 ` Randy Brukardt
2012-07-24  4:23                   ` Adam Beneschan
2012-07-24  7:54                     ` Dmitry A. Kazakov
2012-07-25 23:39                       ` Randy Brukardt
2012-07-26  7:41                         ` Dmitry A. Kazakov
2012-07-26 13:08                           ` Simon Wright
2012-07-26 13:55                             ` Dmitry A. Kazakov
2012-07-27  9:42                               ` AdaMagica
2012-07-27 10:32                                 ` Dmitry A. Kazakov
2012-07-27 11:58                                   ` Georg Bauhaus
2012-07-27 13:04                                     ` Dmitry A. Kazakov
2012-07-28  9:48                                       ` AdaMagica [this message]
2012-07-28 10:37                                         ` Dmitry A. Kazakov
2012-07-28 16:59                                           ` AdaMagica
2012-07-28 18:21                                             ` Dmitry A. Kazakov
2012-07-19  8:04       ` Maciej Sobczak
     [not found]         ` <juaghb$fv9$1@munin.nbi.dk>
2012-07-20  7:30           ` Dmitry A. Kazakov
2012-07-21 17:21             ` Vasiliy Molostov
2012-07-21 19:03               ` Dmitry A. Kazakov
2012-07-21 19:37                 ` Vasiliy Molostov
2012-07-21 20:23                   ` Dmitry A. Kazakov
2012-07-21 20:53                     ` Vasiliy Molostov
2012-07-22  7:41                       ` Dmitry A. Kazakov
2012-07-22  8:00                         ` Vasiliy Molostov
2012-07-22  8:19                           ` Dmitry A. Kazakov
2012-07-22  9:06                             ` Vasiliy Molostov
2012-07-22  9:34                               ` Dmitry A. Kazakov
2012-07-20  8:09           ` Maciej Sobczak
2012-07-20  8:27             ` Dmitry A. Kazakov
2012-07-20 11:30               ` Maciej Sobczak
2012-07-20 12:49                 ` Dmitry A. Kazakov
2012-07-21 22:46                   ` Maciej Sobczak
2012-07-22  8:03                     ` Dmitry A. Kazakov
2012-07-22 10:08               ` Florian Weimer
2012-07-22 11:18                 ` Dmitry A. Kazakov
2012-07-21  0:12             ` Randy Brukardt
2012-07-22  9:52       ` Florian Weimer
replies disabled

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