comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Inherited Methods and such
Date: Tue, 25 Sep 2007 16:02:55 -0500
Date: 2007-09-25T16:02:55-05:00	[thread overview]
Message-ID: <fdbssj$acp$1@jacob-sparre.dk> (raw)
In-Reply-To: 19ie8rfpiitdx$.i2sz3r6uj66w.dlg@40tude.net

"Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de> wrote in message
news:19ie8rfpiitdx$.i2sz3r6uj66w.dlg@40tude.net...
> On Mon, 24 Sep 2007 20:59:53 -0500, Randy Brukardt wrote:
>
...
> > Ada has no choice. You agree that "magic" is needed to do the memory
> > allocation, layout, etc. for the underlying object. (To say otherwise
would
> > be to require all objects to be fixed in size.) But that is not
divisible
> > from the initialization of the value in Ada (and the values of the
> > components), because the memory allocation depends on the value of the
> > discriminants, and even the components that exist depends on those
values.
>
> It can be made divisible:
>
> For each type T we define a plain built-in record type T'Constraints such
> that it has all the constraints (discriminants, bounds, tags) of T. Prior
> allocation of T a user hook is called to return T'Constrants. It gets the
> parameters of the constructor. Then the memory is allocated. After that
the
> implementation type of T is constructed (the constraints are set, the
> components are constructed). Then we proceed to the construction of T.
Here
> the parent types are constructed first and finally a user hook equivalent
> to Initialize is called on T. For class-wide types there is an additional
> step where the class-wide user hook is called.

That's what I tried to do with Janus/Ada, and it doesn't work in all cases.
I don't have a specific example to give, but the problem comes from the
required order of evaluation; we were reading uninitialized values in
obscure cases. I couldn't find anyway around those requirements.

> > Note that this is very similar to the reasons that Ada cannot have
"real"
> > user-defined assignment; it's not possible to divide an assignment into
> > components managed separately.
>
> Same as above. Moreover it would be probably possible to make the old LHS
> visible in the hook computing the constraints.

No, you can't have visibility on both objects in a hook routine, because
there are cases where one side or the other does not exist. You have to
define three sets of hooks, which would greatly increase the chance of
errors and probably would be too complex for most to understand.

The problem doesn't exist if your language doesn't have disappearing
components, and I would be much more likely to try to approach the problem
from there. But that wouldn't be Ada.

                       Randy.





  reply	other threads:[~2007-09-25 21:02 UTC|newest]

Thread overview: 74+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-17 14:26 Inherited Methods and such shaunpatterson
2007-09-17 15:11 ` Ludovic Brenta
2007-09-17 16:46   ` shaunpatterson
2007-09-17 19:07     ` Ludovic Brenta
2007-09-17 20:22   ` Maciej Sobczak
2007-09-17 21:07     ` Ludovic Brenta
2007-09-18 14:27       ` Maciej Sobczak
2007-09-18 14:27       ` Maciej Sobczak
2007-09-18 15:25         ` Dmitry A. Kazakov
2007-09-18 18:34           ` Ludovic Brenta
2007-09-18 19:29             ` Dmitry A. Kazakov
2007-09-18 19:39               ` Ludovic Brenta
2007-09-18 20:49                 ` Dmitry A. Kazakov
2007-09-18 21:10               ` Simon Wright
2007-09-18 20:39           ` Maciej Sobczak
2007-09-18 21:12             ` Dmitry A. Kazakov
2007-09-19 14:49               ` Maciej Sobczak
2007-09-19 15:16                 ` Dmitry A. Kazakov
2007-09-19 22:13                   ` Maciej Sobczak
2007-09-20  8:12                     ` Dmitry A. Kazakov
2007-09-20 13:52                       ` Maciej Sobczak
2007-09-20 16:22                         ` Dmitry A. Kazakov
2007-09-20 20:45                           ` Maciej Sobczak
2007-09-21 18:59                             ` Dmitry A. Kazakov
2007-09-21 21:02                               ` Maciej Sobczak
2007-09-22  8:48                                 ` Dmitry A. Kazakov
2007-09-22 21:53                                   ` Maciej Sobczak
2007-09-23  8:41                                     ` Dmitry A. Kazakov
2007-09-23 20:36                                       ` Maciej Sobczak
2007-09-24  9:32                                         ` Dmitry A. Kazakov
2007-09-24 15:02                                           ` Maciej Sobczak
2007-09-24 19:20                                             ` Dmitry A. Kazakov
2007-09-25 20:53                                               ` Maciej Sobczak
2007-09-26 10:42                                                 ` Dmitry A. Kazakov
2007-09-26 21:31                                                   ` Maciej Sobczak
2007-09-27 15:02                                                     ` Dmitry A. Kazakov
2007-09-27 21:02                                                       ` Maciej Sobczak
2007-09-26 12:21                                                 ` Robert A Duff
2007-09-26 12:54                                                   ` Dmitry A. Kazakov
2007-09-26 21:37                                                   ` Maciej Sobczak
2007-09-26 23:47                                                     ` Randy Brukardt
2007-09-27 21:08                                                       ` Maciej Sobczak
2007-09-28  0:44                                                         ` Randy Brukardt
2007-09-28 20:32                                                           ` Maciej Sobczak
2007-09-28 22:35                                                             ` Randy Brukardt
2007-09-29 23:58                                                             ` Robert A Duff
2007-09-26 12:26                                                 ` Robert A Duff
2007-09-26 21:50                                                   ` Maciej Sobczak
2007-09-26 22:20                                                     ` Ray Blaak
2007-09-27  0:01                                                     ` Randy Brukardt
2007-09-27 13:39                                                     ` Robert A Duff
2007-09-27 14:54                                                       ` Dmitry A. Kazakov
2007-09-28  0:35                                                         ` Randy Brukardt
     [not found]                                                           ` <7p6gc1s9imfa$.kmvwf5zyf8e9.dlg@40tude.net>
2007-09-28 22:53                                                             ` Randy Brukardt
2007-09-29 20:37                                                               ` Dmitry A. Kazakov
2007-09-27 21:23                                                       ` Maciej Sobczak
2007-09-28 19:12                                                         ` Robert A Duff
2007-09-28 19:02                                                     ` Robert A Duff
2007-09-28 19:42                                                       ` Robert A Duff
2007-09-28 20:44                                                         ` Maciej Sobczak
2007-09-28 22:40                                                           ` Randy Brukardt
2007-09-29 20:35                                                           ` Dmitry A. Kazakov
2007-09-29 20:52                                                             ` Maciej Sobczak
2007-09-30  8:38                                                               ` Dmitry A. Kazakov
2007-09-29 23:47                                                             ` Robert A Duff
2007-09-29 20:48                                                           ` Maciej Sobczak
2007-09-29 23:39                                                             ` Robert A Duff
2007-09-30  8:38                                                               ` Dmitry A. Kazakov
2007-09-29 23:42                                                           ` Robert A Duff
2007-09-25  1:59                                   ` Randy Brukardt
2007-09-25  8:59                                     ` Dmitry A. Kazakov
2007-09-25 21:02                                       ` Randy Brukardt [this message]
2007-09-26 12:42                                         ` Dmitry A. Kazakov
2007-09-18  4:03 ` Steve
replies disabled

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