comp.lang.ada
 help / color / mirror / Atom feed
From: Robert A Duff <bobduff@shell01.TheWorld.com>
Subject: Re: Ada202X: Easy to use "UML private"-like components
Date: Sun, 23 Jun 2013 09:12:53 -0400
Date: 2013-06-23T09:12:53-04:00	[thread overview]
Message-ID: <wccmwqhkm22.fsf@shell01.TheWorld.com> (raw)
In-Reply-To: b2nmjsFrifnU1@mid.individual.net

Niklas Holsti <niklas.holsti@tidorum.invalid> writes:

> Pkg.T corresponds to a Modula-2 opaque type (or opaque eport, if you
> prefer). Both the Ada compiler and the Modula-2 compiler know, based on
> the package declaration or the definition module, that Pkg.T is a
> pointer. Neither compiler knows anything about the type of the object to
> which Pkg.T points, until the package body or implementation module is
> compiled.

The compilation model is that when compiling something, the compiler
looks at information coming from the specs of imported things, but not
their bodies.  Modula-2 compilers actually work that way, and this
is the reason for the must-be-pointer (or must be the same size as
a pointer, or smaller, as I had (mis?)remembered it).

It is also the reason for the private part kludge: the compiler sees
the size of the full type for a private type (assuming it is known
at compile time).  But this reasoning makes no sense to me, because
that's not how Ada compilers work.  Any reasonable implementation
of generics and inlining needs to look at bodies.  So full types
should be in bodies, and compilers should look there (at least
in optimizing mode) to find out their size.

On the other hand, the private part kludge wouldn't be so bad if
the syntax were different:  The private part should be a separate
syntactic compilation_unit, with its own with clauses, and should
normally be stored in a separate source file from the visible part.
There's an awful lot of horrible code duplication caused by the
fact that the private part is in the same file as the visible part.
Separating it out into a different file would not prevent the
compiler from looking at it!

- Bob

  reply	other threads:[~2013-06-23 13:12 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-21  8:43 Ada202X: Easy to use "UML private"-like components Martin
2013-06-21  9:23 ` Dmitry A. Kazakov
2013-06-21  9:33   ` Martin
2013-06-21 10:14     ` G.B.
2013-06-21 11:19       ` Martin
2013-06-21 14:51     ` Dmitry A. Kazakov
2013-06-22 11:16       ` Martin
2013-06-22 12:10         ` Dmitry A. Kazakov
2013-06-21 18:36 ` Robert A Duff
2013-06-22 16:41   ` Niklas Holsti
2013-06-22 19:05     ` Dennis Lee Bieber
2013-06-22 22:57       ` Niklas Holsti
2013-06-23  3:26         ` Dennis Lee Bieber
2013-06-23  7:32           ` Niklas Holsti
2013-06-23 13:12             ` Robert A Duff [this message]
2013-06-23 14:06               ` Dmitry A. Kazakov
2013-06-23 15:15                 ` Robert A Duff
2013-06-23 18:52                   ` Dmitry A. Kazakov
2013-06-23 23:38                     ` Robert A Duff
2013-06-24  7:16                       ` Dmitry A. Kazakov
2013-06-24 20:11                         ` Randy Brukardt
2013-06-25  7:21                           ` Dmitry A. Kazakov
2013-06-25 19:06                             ` Randy Brukardt
2013-06-24 20:07                 ` Randy Brukardt
2013-06-23 14:40               ` Shark8
2013-06-23 15:28                 ` Robert A Duff
2013-06-23 18:14                   ` Bill Findlay
2013-06-23 23:43                     ` Robert A Duff
2013-06-23 23:48                       ` Bill Findlay
2013-06-24 20:16                   ` Randy Brukardt
2013-06-24 20:05               ` Randy Brukardt
2013-06-25  1:09                 ` Robert A Duff
2013-06-25 19:37                   ` Randy Brukardt
2013-06-23 12:28         ` Robert A Duff
2013-06-24 20:20           ` Randy Brukardt
2013-06-24 21:40             ` Niklas Holsti
2013-06-25  0:43               ` Robert A Duff
2013-06-25 19:23                 ` Randy Brukardt
2013-06-25 19:19               ` Randy Brukardt
2013-07-09 11:24   ` Martin
2013-07-09 14:39     ` Simon Wright
2013-07-10  7:03       ` Martin
2013-07-09 21:43     ` Robert A Duff
2013-07-10  6:34       ` Martin
2013-07-10  8:24         ` Dmitry A. Kazakov
2013-07-10 13:06           ` Martin
2013-07-10 16:12     ` Simon Wright
2013-07-10 18:22       ` Martin
2013-07-10 19:41         ` Simon Wright
2013-07-11 18:28           ` Martin
2013-07-11 19:37             ` Simon Wright
2013-07-11 20:43               ` Martin
2013-07-12  6:57                 ` Simon Wright
2013-07-12  8:05                   ` Martin
replies disabled

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