comp.lang.ada
 help / color / mirror / Atom feed
From: Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject: Re: Ada202X: Easy to use "UML private"-like components
Date: Sat, 22 Jun 2013 15:05:58 -0400
Date: 2013-06-22T15:05:58-04:00	[thread overview]
Message-ID: <9qrbs8l828t3pvgves504a8fm7o1c7tcpj@4ax.com> (raw)
In-Reply-To: b2m2csFh64iU1@mid.individual.net

On Sat, 22 Jun 2013 19:41:00 +0300, Niklas Holsti
<niklas.holsti@tidorum.invalid> declaimed the following:

>
>"The corresponding implementation module must contain a full type
>declaration for any opaque types declared in the definition module.  The
>full type declaration must define a pointer type."
>
>I take this to mean that a Modula-2 opaque type uses indirection through
>a pointer type, just as the "stt access types" in Ada, and unlike Ada
>private types in general.

	I suspect that limitation comes about as lacking any knowledge of a
structure, only the type name, the compiler doing the import has to make
assumptions about the storage space of the type -- only a pointer would
have a common, preknown, storage size for all imported opaque types.

	From "Programming in Modula-2: 3rd, corrected edition" [N. Wirth; 1985
Springer-Verlag], page 169:

"""
Definition modules imply the use of qualified export. Type definitions may
consist of the full specification of the type (in this case its export is
said to be transparent), or they may consist of the type identifier only.
In this case the full specification must appear in the corresponding
implementation module, and its export is said to be /opaque/. The type is
known in the importing client modules by its name only, and all its
properties are hidden. Therefore,  procedures operating on operands of this
type, and in particular operating on its components, must be defined in the
same implementation module which hides the type's properties. Opaque export
is restricted to pointers. Assignment and test for equality are applicable
to all opaque types.
"""

	Ada puts the details of the "hidden" part into the specification, where
the compiler is capable of determining required space and generating
instructions to copy (assign) or otherwise manipulate the structure -- even
while preventing the programmer importing the specification from taking
advantage of that knowledge.

	The use of a Modula-2 opaque export doesn't see it as a pointer -- it
just a variable of the named type; the implementation module is where it is
defined a pointer to some structure. Note that a strict reading of PiM-2 is
not defining an "opaque type" but rather an "opaque export" <G>.
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/


  reply	other threads:[~2013-06-22 19:05 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 [this message]
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
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